Unfortunately, I don't have any examples handy.
Using ImageMagick to make sharp web-sized photographs
51–60 of 64 posts
Re: Using ImageMagick to make sharp web-sized photographs
#52Dissecting a bad oneliner: ls *.jpg|while read i;do gm convert $i -resize "900x" -unsharp 2x0.5+0.5+0 -quality 98 `basename $i .jpg`_s.jpg;done The part I take issue with is the unnecessary invocation of `ls`. The shell does the glob expansion. A `for` loop is better suited for this. Also, if using bash,* we can get rid of basename. for file in *.jpg; do gm convert $file -resize "900x" -unsharp 2x0.5+0.5+0 -quality 9…
Get in the habit of putting $file (and, in this case, ${file%.jpg}_s.jpg) in double quotes. Your one-liner (and theirs) will blow up spectacularly if there's whitespace in a filename:
bash-3.2$ for i in 'lots of spaces'.jpg '1 2'.jpg; do printf 'arg = %s\n' ${i%.jpg}_s.jpg; done
arg = lots
arg = of
arg = spaces_s.jpg
arg = 1
arg = 2_s.jpg
bash-3.2$ for i in 'lots of spaces'.jpg '1 2'.jpg; do printf 'arg = %s\n' "${i%.jpg}_s.jpg"; done
arg = lots of spaces_s.jpg
arg = 1 2_s.jpg
EDIT: It's also worth noting that, by default, zsh doesn't split on whitespace in parameter expansion like sh, bash, etc. do. ("man zshexpn" and search for "SH_WORD_SPLIT")Re: Using ImageMagick to make sharp web-sized photographs
#53Dissecting a bad oneliner: ls *.jpg|while read i;do gm convert $i -resize "900x" -unsharp 2x0.5+0.5+0 -quality 98 `basename $i .jpg`_s.jpg;done The part I take issue with is the unnecessary invocation of `ls`. The shell does the glob expansion. A `for` loop is better suited for this. Also, if using bash,* we can get rid of basename. for file in *.jpg; do gm convert $file -resize "900x" -unsharp 2x0.5+0.5+0 -quality 9…
basename -s .jpg -a *jpg |
xargs -I{} convert "{}.jpg" \
-resize "900x" -unsharp 2x0.5+0.5+0 -quality 98 "{}_s.jpg"
EDIT: weird line breaking is to prevent sidescroll boxRe: Using ImageMagick to make sharp web-sized photographs
#54mod_pagespeed (and ngx_pagespeed) can automate this for all your images. If you have inline width/height or inline style dimensions, it will do the resampling on your behalf: https://developers.google.com/speed/pagespeed/module/filter-... The advantages of having correctly sized imagery are immense, but in short.. something like 70% smaller total byte payload for mobile, huge reduction in image decode & resize cost,…
> pagespeed EnableFilters resize_images;Re: Using ImageMagick to make sharp web-sized photographs
#55Dissecting a bad oneliner: ls *.jpg|while read i;do gm convert $i -resize "900x" -unsharp 2x0.5+0.5+0 -quality 98 `basename $i .jpg`_s.jpg;done The part I take issue with is the unnecessary invocation of `ls`. The shell does the glob expansion. A `for` loop is better suited for this. Also, if using bash,* we can get rid of basename. for file in *.jpg; do gm convert $file -resize "900x" -unsharp 2x0.5+0.5+0 -quality 9…
As long as we're bashing , it could easily be written loopless like so: basename -s .jpg -a *jpg | xargs -I{} convert "{}.jpg" \ -resize "900x" -unsharp 2x0.5+0.5+0 -quality 98 "{}_s.jpg" EDIT: weird line breaking is to prevent sidescroll box
Re: Using ImageMagick to make sharp web-sized photographs
#56mod_pagespeed (and ngx_pagespeed) can automate this for all your images. If you have inline width/height or inline style dimensions, it will do the resampling on your behalf: https://developers.google.com/speed/pagespeed/module/filter-... The advantages of having correctly sized imagery are immense, but in short.. something like 70% smaller total byte payload for mobile, huge reduction in image decode & resize cost,…
where are the resizes stored when this directive is used? > pagespeed EnableFilters resize_images;
Re: Using ImageMagick to make sharp web-sized photographs
#57ImageOptim has been my best buddy, been getting very agreeable results with it. It's just for compression but end results don't seem to have the need for sharpening. Using ImageMagick this way might be best for special cases... http://imageoptim.com/
ImageOptim is not just for compression, it is for stripping away useless metadata, color palettes and other tricks. For optimal images, you could do something like this: 1) Resize the image (And apply the trick from this article) use the proper quality marker (anywhere between 85-95) 2) Run it through Imageoptim If you want a commandline version of ImageOptim, I have had good results with https://github.com/toy/image…
Re: Using ImageMagick to make sharp web-sized photographs
#58For my games, I found out that the best thing when scaling is use IM Lancsoz filter. Granted, my games use high-res hand-drawn vector-ish art (not pixel art, neither photo-style or paint-style art) so I dunno if this is applicable to photos.
Re: Using ImageMagick to make sharp web-sized photographs
#59Is this tool doing anything other than a deconvolution?
Re: Using ImageMagick to make sharp web-sized photographs
#60Part of the reason rescaled images look dim and blurry is because rescaling software usually assumes gamma 1.0 instead of 2.2: http://www.4p8.com/eric.brasseur/gamma.html There are many more good essays on image rescaling here: http://entropymine.com/imageworsener/