You are not logged in.
Pages: 1
I want to have the same case effect that sonata has to use with conky, until now I got a somewhat working script, but the case overlay cuts some pixels on the left, and when the cover image isn't a square the script stretch the image, does anyone know a fix for that?
my litle script:
#!/bin/zsh
dest='/home/augusto/.conky'
cover_path=$(mpd_info album-art)
composite_image='/home/augusto/.conky/case.png'
rm "$dest/album_art.png"
#convert -geometry 118x128! $cover_path "$dest/album_art.png"
composite $composite_image -geometry 128x128 $cover_path "$dest/album_art.png"
case.png is a resized image of /usr/share/pixmaps/sonata-case.png
% identify case.png
case.png PNG 128x128 128x128+0+0 8-bit DirectClass 2.38KiB 0.000u 0:00.000
here is how sonata does that, I just don't know how to do that with ImageMagick :\
def artwork_apply_composite_case(self, pix, w, h):
if self.config.covers_type == consts.COVERS_TYPE_STYLIZED and float(w)/h > 0.5:
# Rather than merely compositing the case on top of the artwork, we will
# scale the artwork so that it isn't covered by the case:
spine_ratio = float(60)/600 # From original png
spine_width = int(w * spine_ratio)
case = self.casepb.scale_simple(w, h, gtk.gdk.INTERP_BILINEAR)
# Scale pix and shift to the right on a transparent pixbuf:
pix = pix.scale_simple(w-spine_width, h, gtk.gdk.INTERP_BILINEAR)
blank = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, w, h)
blank.fill(0x00000000)
pix.copy_area(0, 0, pix.get_width(), pix.get_height(), blank, spine_width, 0)
# Composite case and scaled pix:
case.composite(blank, 0, 0, w, h, 0, 0, 1, 1, gtk.gdk.INTERP_BILINEAR, 250)
del case
return blank
return pix
Last edited by hack.augusto (2009-11-01 17:10:03)
Offline
got it:
#!/bin/zsh
# config
destianation='/home/augusto/.conky'
album_art=$(mpd_info album-art)
case_path="/usr/share/pixmaps/sonata-case.png"
# clearing lefovers
rm "$destianation/album_art.png"
rm "$destianation/case_resized.png"
# resizing, keeping proportion
convert -geometry 128x128 $album_art "$destianation/album_art.png"
# gathering thumbnail geomtry
width=`identify $destianation/album_art.png | sed -E "s/.* ([0-9]*)x.*/\1/"`
height=`identify $destianation/album_art.png | sed -E "s/.* [0-9]*x([0-9]*) .*/\1/"`
# the cover itself is 90% of the image, the other 10% is for the spine of the case
(( cover_width = width * ( 10.0/9.0 ) ))
convert -geometry "$(( cover_width ))x$height!" $case_path "$destianation/case_resized.png"
# done!
composite "$destianation/case_resized.png" "$destianation/album_art.png" "$destianation/album_art.png"
Offline
Pages: 1