Discussion:
Preserving image class when combining images of same class
Brock Murch
2011-04-15 18:15:02 UTC
Permalink
I have 2 images that are PseudoClass 256c with the same palette.

optics 191 :/optics1/virtual_ant/etc/cl> identify secoora.west.qkm_sst.png
secoora.west.qkm_sst.png PNG 3740x7480 3740x7480+0+0 PseudoClass 256c 94kb

optics 192 :/optics1/virtual_ant/etc/cl> identify secoora.east.qkm_sst.png
secoora.east.qkm_sst.png PNG 3740x7480 3740x7480+0+0 PseudoClass 256c
2.2e+02kb 0.350u 0:02

When I am putting them together:

optics 193 :/optics1/virtual_ant/etc/cl> convert secoora.west.qkm_sst.png
secoora.east.qkm_sst.png +append secoora.full.qkm_sst.png

I end up with the proper image, but now DirectClass.

optics 196 :/optics1/virtual_ant/etc/cl> identify secoora.full.qkm_sst.png
secoora.full.qkm_sst.png PNG 7480x7480 7480x7480+0+0 DirectClass 7.9e+02kb
2.940u 0:04

I need to preserve the 256c palette they both have in common as the index
numbers have meaning to me (not just the colors) Is this possible?

Thanks,
Brock
Fred Weinhaus
2011-04-15 22:33:41 UTC
Permalink
You can try various things:

add -type palette to your command line after the +append

or

preface the output image with PNG8:secoora.full.qkm_sst.png

or look at the write options for PNG at
http://www.imagemagick.org/Usage/formats/#png_write


I suspect that IM will take the colortable from the first image in
the sequence if you do one of the above, but I am not an expert on
that, so don't count on it.

But do get back and inform us if this works or not.
Post by Brock Murch
optics 193 :/optics1/virtual_ant/etc/cl> convert secoora.west.qkm_sst.png
secoora.east.qkm_sst.png +append secoora.full.qkm_sst.png
Anthony Thyssen
2011-04-16 06:25:41 UTC
Permalink
On Fri, 15 Apr 2011 15:33:41 -0700
magick-users-***@imagemagick.org wrote:
| You can try various things:
|
| add -type palette to your command line after the +append
|
| or
|
| preface the output image with PNG8:secoora.full.qkm_sst.png
|
| or look at the write options for PNG at
| http://www.imagemagick.org/Usage/formats/#png_write
|
|
| I suspect that IM will take the colortable from the first image in
| the sequence if you do one of the above, but I am not an expert on
| that, so don't count on it.
|
| But do get back and inform us if this works or not.
|
No it will create a new palette IF the current image is using colors
that are NOT in any existing palette.

At least that is how it works for GIF.

For PNG I am not certain as there are bee a lot of work in that area.
If you had asked on the forum, then the developer Glenn may have
something to say.



Anthony Thyssen ( System Programmer ) <***@griffith.edu.au>
--------------------------------------------------------------------------
I wouldn't take a bribe even if you paid me! -- Anthony Thyssen
--------------------------------------------------------------------------
Anthony's Castle http://www.ict.griffith.edu.au/anthony/
Fred Weinhaus
2011-04-16 22:26:31 UTC
Permalink
Post by Anthony Thyssen
No it will create a new palette IF the current image is using colors
that are NOT in any existing palette.
I was under the impression from his first post that both images have
the same colortable.


Fred
Brock Murch
2011-04-18 13:41:19 UTC
Permalink
Post by Fred Weinhaus
Post by Anthony Thyssen
No it will create a new palette IF the current image is using colors
that are NOT in any existing palette.
I was under the impression from his first post that both images have
the same colortable.
The first creates a 64 bit palette (not 8 bit) but the image itself looked
correct.

convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append -type
palette test.png
optics 220 :/optics1/virtual_ant/etc/cl> identify test.png
test.png PNG 7480x7480 7480x7480+0+0 PseudoClass 65536c 3.8e+02kb 0.980u 0:02

The second, oddly, created a proper sized image, but scrunched the contents of
both into 1/4 of the image on the x axis. So the top to bottom perspective
was maintained, but the left to right was skewed with the whole appended
image in the left 1/4 and right 3/4 of the image all in black. As you can see
it is a 3 bit palette.

convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append
PNG8:test2.png
optics 224 :/optics1/virtual_ant/etc/cl> identify test2.png
test2.png PNG 7480x7480 7480x7480+0+0 PseudoClass 3c 1.5e+02kb

Thanks

Brock
Post by Fred Weinhaus
Fred
_______________________________________________
Magick-users mailing list
http://studio.imagemagick.org/mailman/listinfo/magick-users
Brock Murch
2011-04-18 13:20:03 UTC
Permalink
Yes, both original images have the same color table.
Post by Fred Weinhaus
Post by Anthony Thyssen
No it will create a new palette IF the current image is using colors
that are NOT in any existing palette.
I was under the impression from his first post that both images have
the same colortable.
Fred
_______________________________________________
Magick-users mailing list
http://studio.imagemagick.org/mailman/listinfo/magick-users
Fred Weinhaus
2011-04-18 17:03:29 UTC
Permalink
Brock,

I would suggest you repost this to the Discourse Server Users forum
(http://www.imagemagick.org/discourse-server/), where the PNG
developer might have a better chance of seeing this and responding.
Also other IM users may have more knowledge about this situation.
PNG has been undergoing quite some changes (bug fixes and
enhancements over the last many releases. You could also post links
to your two images so others can test. Perhaps your version of IM
needs upgrading. I don't recall if you mentioned what version you are
using.

Fred
Post by Brock Murch
The first creates a 64 bit palette (not 8 bit) but the image itself looked
correct.
convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append -type
palette test.png
optics 220 :/optics1/virtual_ant/etc/cl> identify test.png
test.png PNG 7480x7480 7480x7480+0+0 PseudoClass 65536c 3.8e+02kb 0.980u 0:02
The second, oddly, created a proper sized image, but scrunched the contents of
both into 1/4 of the image on the x axis. So the top to bottom perspective
was maintained, but the left to right was skewed with the whole appended
image in the left 1/4 and right 3/4 of the image all in black. As you can see
it is a 3 bit palette.
convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append
PNG8:test2.png
optics 224 :/optics1/virtual_ant/etc/cl> identify test2.png
test2.png PNG 7480x7480 7480x7480+0+0 PseudoClass 3c 1.5e+02kb
Thanks
Brock
Brock Murch
2011-04-19 18:03:20 UTC
Permalink
Thanks, settled by doing it in idl. No time to play, :(

Brock
Post by Fred Weinhaus
Brock,
I would suggest you repost this to the Discourse Server Users forum
(http://www.imagemagick.org/discourse-server/), where the PNG
developer might have a better chance of seeing this and responding.
Also other IM users may have more knowledge about this situation.
PNG has been undergoing quite some changes (bug fixes and
enhancements over the last many releases. You could also post links
to your two images so others can test. Perhaps your version of IM
needs upgrading. I don't recall if you mentioned what version you are
using.
Fred
Post by Brock Murch
The first creates a 64 bit palette (not 8 bit) but the image itself looked
correct.
convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append -type
palette test.png
optics 220 :/optics1/virtual_ant/etc/cl> identify test.png
test.png PNG 7480x7480 7480x7480+0+0 PseudoClass 65536c 3.8e+02kb 0.980u 0:02
The second, oddly, created a proper sized image, but scrunched the
contents of both into 1/4 of the image on the x axis. So the top to
bottom perspective was maintained, but the left to right was skewed with
the whole appended image in the left 1/4 and right 3/4 of the image all
in black. As you can see it is a 3 bit palette.
convert secoora.west.qkm_sst.png secoora.east.qkm_sst.png +append
PNG8:test2.png
optics 224 :/optics1/virtual_ant/etc/cl> identify test2.png
test2.png PNG 7480x7480 7480x7480+0+0 PseudoClass 3c 1.5e+02kb
Thanks
Brock
_______________________________________________
Magick-users mailing list
http://studio.imagemagick.org/mailman/listinfo/magick-users
Fred Weinhaus
2011-04-19 17:26:51 UTC
Permalink
It seems to work fine in IM 6.6.9.5 Q16 Mac OSX Tiger.

I did the following:

convert rose: +dither -map colortable1.gif rose_ct1.png
identify -verbose rose_ct1.png

convert rose_ct1.png rose_ct1.png +append rose_ct1_append.png
identify -verbose rose_ct1_append.png


The appended image has the very same colormap as the two images
appended (which are identical since I appended the same images)

Colormap: 23
0: ( 47, 79, 47) #2F4F2F rgb(47,79,47)
1: (165, 42, 42) #A52A2A brown
2: (205, 92, 92) #CD5C5C IndianRed
3: (220, 20, 60) #DC143C crimson
4: (105,105,105) #696969 DimGray
5: (126,126,126) #7E7E7E gray
6: ( 72, 61,179) #483DB3 rgb(72,61,179)
7: (176, 48, 96) #B03060 rgb(176,48,96)
8: (176,196,222) #B0C4DE LightSteelBlue
9: (152,251,152) #98FB98 PaleGreen
10: (178, 34, 34) #B22222 firebrick
11: (255, 20,147) #FF1493 DeepPink
12: (255,127, 80) #FF7F50 coral
13: (211,211,211) #D3D3D3 LightGray
14: (246,247,238) #F6F7EE rgb(246,247,238)
15: (255,255,255) #FFFFFF white
16: (255,105,180) #FF69B4 HotPink
17: (255,192,203) #FFC0CB pink
18: (245,245,220) #F5F5DC beige
19: (240,255,240) #F0FFF0 honeydew
20: (210,105, 30) #D2691E chocolate
21: (250,128,114) #FA8072 salmon
22: (240,230,140) #F0E68C khaki
Continue reading on narkive:
Loading...