Page 1 of 1
					
				png -sample changes png format
				Posted: 2016-11-23T18:14:21-07:00
				by zak
				I'm upscaling rgba pngs with sample, I save a 8bit/channel RGB png with transparent parts in photoshop(its rgba) and I run: 
Code: Select all
for /f "tokens=*" %%a in (dimensions10.txt) do magick convert %filename% -sample %%ax%%a  out\%filename%-%%a.png  
I have also tried this and all combinations of these 2:
Code: Select all
magick convert %filename%  -channel rgba -alpha on -interpolate Nearest -filter point -define png32:bit-depth=8 -resize %%ax%%a out\%filename%-%%a.png
Now when I load the resulting pngs back to photoshop it says indexed color. 
Interestingly this produces the exact format I want I guess:
Code: Select all
magick convert -size %%ax%%a -interpolate Nearest -filter point -background none -fill purple -gravity center -font Arial-Bold label:"%%a" %%a.png
So how can I keep the exact format on the convert -sample on the top?
Other thing, I tried to pack a png into an icon with auto resize which works also with the above filters and everything, loses transparency though.
Also I can't pack bigger than 256px images inside,
and the 256px in the ico is always corrupted when I open it in an editor, I can find no info about controlling the output ico on the documentation.
Please help me.
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T19:00:30-07:00
				by fmw42
				If you want to save a PNG as 24bit color, then preface the output with PNG24:output.png. If you want 8bit color (palette), the preface the output with PNG8:output.png. If you want 32 bit color (24 bit rgb and 8 bit alpha), then preface the output with PNG32:output.png
see 
http://www.imagemagick.org/Usage/formats/#png_formats 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T19:22:28-07:00
				by zak
				I have tried all these before with no luck, png24: even tried png:32 and all of them with "-channel rgba -alpha on", still I get pngs with indexed colors.
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T19:32:31-07:00
				by fmw42
				Then try from 
http://www.imagemagick.org/Usage/formats/#png_write
-define png:bit-depth=24
just before the output
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T19:48:56-07:00
				by zak
				I already tried it, and now again and the result is the same.
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T20:33:56-07:00
				by fmw42
				I will defer to the PNG developer on this as I have exhausted my thoughts.
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-23T21:19:28-07:00
				by zak
				Thank You!
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T06:30:44-07:00
				by glennrp
				The PNG developer would like to know what version of IM you are using and on what platform (Windows, I suppose, because of the %%'s).
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T15:29:29-07:00
				by glennrp
				
png:bit-depth must be 1, 2, 4, 8, or 16.  An attempt to set it to 24 will be silently ignored.
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T16:27:32-07:00
				by zak
				I'm on 7.0.3-7 Q16 x64 2016-11-15 on win10
I have tried all possible combinations of the above mentioned parameters(in the whole topic), no luck.
Also, if I do this: 
Code: Select all
magick convert -size %%ax%%a -interpolate Nearest -filter point -background #55ffff -fill #ff55ff -gravity center -font Arial-Bold label:"%%a" %%a.png
 Then I get a 16 bit / channel  image why? 
If I use:
Code: Select all
magick convert -size %%ax%%a -interpolate Nearest -filter point -background none -fill blue -gravity center -font Arial-Bold label:"%%a" %%a.png
 I get a 8bit / channel image as intended with rgba.
If I run:
Code: Select all
magick convert -size %%ax%%a -interpolate Nearest -filter point -background none -fill blue -gravity center -font Arial-Bold label:"%%a" -define png:bit-depth=8 %%a.png
 I'll get indexed color.
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T17:50:17-07:00
				by glennrp
				If you want rgba8888 then ask for "png32:%%a.png" as output.  You don't need to define the png:bit-depth because png32 implies bit-depth=8.
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T18:12:47-07:00
				by zak
				For this:
Code: Select all
magick convert %filename% -channel rgba -alpha on -sample %%ax%%a  -define png32:out\%filename%-%%a.png 
I get this:
Code: Select all
convert:  `png32:out\p.png-20.png' @ error/convert.c/ConvertImageCommand/3250.
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T19:59:44-07:00
				by fmw42
				Remove the -define
Code: Select all
magick convert %filename% -channel rgba -alpha on -sample %%ax%%a  png32:out\%filename%-%%a.png
or
Code: Select all
magick %filename% -channel rgba -alpha on -sample %%ax%%a  png32:out\%filename%-%%a.png
 
			 
			
					
				Re: png -sample changes png format
				Posted: 2016-11-24T20:34:10-07:00
				by zak
				Thank You it works! 
I can loose the "-channel rgba -alpha on" also (png32=rgba8888) , right?  I mean whatever my input format is, if there is transparency then it will be retained without those swiches?