Page 1 of 1

PNG resize question

Posted: 2012-08-09T11:37:54-07:00
by juray
Hi,

I'm new in ImageMagic. Im trying to resize png file with this simple command

Code: Select all

convert wlbn_120809_085727_609.png -resize 1000x resize_image.png
but result differs against original in colour and size too. Colour of the result image is more darker than original (i've tried also -quality, -colorspace functions)
Same problem i see in converting FIT, FITS to PNG or only displaying FIT, FITS. Displayed/converted FITS has more black and constrast places than original.

Im working with 8bit grayscale astrophotos of Sun surface and with imagemagick i want to optimize further photos processing.

Thank you for your advices. J.

Re: PNG resize question

Posted: 2012-08-09T14:02:25-07:00
by fmw42
what version of IM and platform are you using? grayscale images are now handled as linear rather than sRGB. but there was a transition so some versions of IM may have bugs.

does it happen without the resize?

can you post a link to one of your grayscale images?

otherwise perhaps try

convert grayscale.png -colorspace sRGB -resize ... result

Re: PNG resize question

Posted: 2012-08-09T18:05:48-07:00
by henrywho
r u really upsizing by 1000 times?

Re: PNG resize question

Posted: 2012-08-09T20:03:20-07:00
by anthony
henrywho wrote:r u really upsizing by 1000 times?
No that is not 1000 times, it is 1000 pixels wide!!!!

For a 1000 times resize you would use 100000%


Or using IMv7 'magick' command you can use -resize '%[fx:w*1000]x' to DIY the calculation yourself!

That was my last update to IMv7 CLI. I have been snowed by 'life' since, but trying to get this into 'setting' arguments (like -size) as well as for 'operator' arguments such as the -resize.

Re: PNG resize question

Posted: 2012-08-10T02:44:06-07:00
by juray
OK what am i doing....?

Versions of software:

Code: Select all

$ uname -or
3.0.36-1-lts GNU/Linux
$ convert -version
Version: ImageMagick 6.7.8-1 2012-07-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:     

Resizing sample PNG:

Code: Select all

$ identify original.png 
original.png PNG 744x1052 744x1052+0+0 8-bit DirectClass 33.5KB 0.000u 0:00.000
$ convert original.png -resize 50% original_resized.png
$ identify original_resized.png
original_resized.png PNG 372x526 372x526+0+0 8-bit PseudoClass 256c 7.39KB 0.000u 0:00.010
In resized image i see changes in gray colour. It is darker.

And same process of image with -resize 100% with same result:

Code: Select all

$ identify original.png 
original.png PNG 744x1052 744x1052+0+0 8-bit DirectClass 33.5KB 0.000u 0:00.000
$ convert original.png -resize 100% original_notresized.png
$ identify original_notresized.png
original_notresized.png PNG 744x1052 744x1052+0+0 8-bit PseudoClass 256c 15.3KB 0.000u 0:00.000
i think its not problem of -resize. Try:

Code: Select all

convert original.png original2.png
gets same result. -colospace RGB doesn't help.

You can download these sample images here:

Code: Select all

http://www.ulozto.net/xnDnuoh/pngimages-tar-gz
Documentation of convert -resize command is huge. I hope that you help me. I have another but similar issue about converting and displaying FITS, FIT images.



Thanks a lot. J.

Re: PNG resize question

Posted: 2012-08-11T06:54:29-07:00
by henrywho
With 6.7.8-9 Win64 DLL, gray images appear to be causing troubles again:

Code: Select all

convert rings_lg_orig.png -alpha off -colorspace RGB -filter RobidouxSharp -distort resize 50% -colorspace sRGB -alpha off +repage -quality 95% test1.png

Code: Select all

convert rings_lg_orig.png -alpha off -evaluate POW 2.2 -filter RobidouxSharp -distort resize 50% -gamma 2.2 -alpha off +repage -quality 95% test2.png
test1.png is noticeably lighter than it should be. Juray's original.png is not revealing this problem though.

http://www.imagemagick.org/Usage/resize ... g_orig.png

Re: PNG resize question

Posted: 2012-08-12T07:56:35-07:00
by henrywho
It works again by adding "-set colorspace sRGB".

Code: Select all

convert rings_lg_orig.png -alpha off -set colorspace sRGB -colorspace RGB -filter RobidouxSharp -distort resize 50% -colorspace sRGB -alpha off +repage -quality 95% test1b.png