PNG resize question

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
juray
Posts: 2
Joined: 2012-08-09T11:27:50-07:00
Authentication code: 67789

PNG resize question

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG resize question

Post 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
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: PNG resize question

Post by henrywho »

r u really upsizing by 1000 times?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: PNG resize question

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
juray
Posts: 2
Joined: 2012-08-09T11:27:50-07:00
Authentication code: 67789

Re: PNG resize question

Post 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.
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: PNG resize question

Post 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
henrywho
Posts: 188
Joined: 2011-08-17T06:46:40-07:00
Authentication code: 8675308

Re: PNG resize question

Post 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
Post Reply