Odd issues when compiling on windows
Odd issues when compiling on windows
I'm using the MagickWand API in the Imagick -project. The problem is that when I compile Imagick statically against ImageMagick libraries the PNG transparency does not work.
This happens on Windows and with all versions of ImageMagick (including 6.3.6) I have tested and with Q8 and Q16. I'm totally out of ideas why this might happen.
This happens on Windows and with all versions of ImageMagick (including 6.3.6) I have tested and with Q8 and Q16. I'm totally out of ideas why this might happen.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
With the static build im able to achieve whole image transparency with adding this method call:
$im->setImageOpacity( 0 );
Without that the image created with newimage and PixelWand transparent is shown black.
$im->setImageOpacity( 0 );
Without that the image created with newimage and PixelWand transparent is shown black.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
I downloaded this compile of the MagickWand PHP extension:
http://www.dirk.sh/dirk/magickwand/
(The static compile).
And tested it with this code:
This results also into a black image.
http://www.dirk.sh/dirk/magickwand/
(The static compile).
And tested it with this code:
Code: Select all
<?php
$m = NewMagickWand();
$p = NewPixelWand();
PixelSetColor( $p, "transparent" );
MagickNewImage( $m, 100, 100, $p );
MagickSetImageFormat( $m, "png" );
MagickWriteImage( $m, "trans_magick.png" );
?>
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Odd issues when compiling on windows
Hi Mikko,
I tried a C version of your code and it produces a transparent PNG.
The problem might be with the viewer you are using. Does it display transparency in a way that
shows up, such as the checkerboard pattern that Paint Shop Pro uses?
Instead of "transparent" try this "rgba(255,0,0,0.0)". If your viewer shows this
as a red square then it's not handling transparency properly.
Pete
I tried a C version of your code and it produces a transparent PNG.
The problem might be with the viewer you are using. Does it display transparency in a way that
shows up, such as the checkerboard pattern that Paint Shop Pro uses?
Instead of "transparent" try this "rgba(255,0,0,0.0)". If your viewer shows this
as a red square then it's not handling transparency properly.
Pete
Re: Odd issues when compiling on windows
The viewers I tested are: Windows Image Viewer (the built in one), firefox and Gimp.el_supremo wrote:Hi Mikko,
I tried a C version of your code and it produces a transparent PNG.
The problem might be with the viewer you are using. Does it display transparency in a way that
shows up, such as the checkerboard pattern that Paint Shop Pro uses?
Instead of "transparent" try this "rgba(255,0,0,0.0)". If your viewer shows this
as a red square then it's not handling transparency properly.
Pete
Here is a link to the generated image:
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
And here is the identify -verbose output:
Here is the identify output using exactly the same code in linux:
Code: Select all
mikko@todellisuus:~/public_html$ identify -verbose trans_win.png
Image: trans_win.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 200x200+0+0
Type: PaletteMatte
Endianess: Undefined
Colorspace: RGB
Depth: 1-bit
Channel depth:
Red: 1-bit
Green: 1-bit
Blue: 1-bit
Alpha: 1-bit
Channel statistics:
Red:
Min: 1 (1)
Max: 1 (1)
Mean: 1 (1)
Standard deviation: 0 (0)
Green:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Blue:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Opacity:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Histogram:
40000: (255, 0, 0, 0) #FF0000 red
Rendering intent: Undefined
Resolution: 72x72
Units: Undefined
Filesize: 628b
Interlace: None
Background color: rgb(1,1,1)
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: none
Page geometry: 200x200+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Signature: d6550ab15fc613b897a575c3bac1f09fb6c9ebe160312438709f18a8f693b55e
Tainted: False
Version: ImageMagick 6.3.6 10/02/07 Q16 http://www.imagemagick.org
Code: Select all
mikko@todellisuus:~/public_html$ identify -verbose trans_lin.png
Image: trans_lin.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 200x200+0+0
Type: PaletteMatte
Endianess: Undefined
Colorspace: RGB
Depth: 1-bit
Channel depth:
Red: 1-bit
Green: 1-bit
Blue: 1-bit
Alpha: 1-bit
Channel statistics:
Red:
Min: 1 (1)
Max: 1 (1)
Mean: 1 (1)
Standard deviation: 0 (0)
Green:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Blue:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Opacity:
Min: 1 (1)
Max: 1 (1)
Mean: 1 (1)
Standard deviation: 0 (0)
Alpha: rgba(255,0,0,1) #FFFF000000000000
Histogram:
40000: (65535, 0, 0,65535) #FFFF000000000000 rgba(255,0,0,1)
Rendering intent: Undefined
Resolution: 72x72
Units: Undefined
Filesize: 826b
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: none
Page geometry: 200x200+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Signature: 780ab2cbd31b6ca6ef808f07ea25d432e7d097649df51b6fc1f97ef17f917e25
Tainted: False
Version: ImageMagick 6.3.6 10/02/07 Q16 http://www.imagemagick.org
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
I assume something that is initialized with DLLs is not intialized in static compile.
Pete, did you compile your C code with static or dynamic linking?
Pete, did you compile your C code with static or dynamic linking?
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Odd issues when compiling on windows
It uses 6.3.5 Q8 dynamic linking.
Pete
Pete
Re: Odd issues when compiling on windows
I was only able to get this issue with static linking. If I link dynamically everything works.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
Pete,
if you have time some day could you try this issue with static compile?
if you have time some day could you try this issue with static compile?
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Odd issues when compiling on windows
Mikko,
I'll try to do that on the weekend.
Meanwhile, it has struck me as odd that identify prints different formats for the histogram.
The first was printed as:
Pete
I'll try to do that on the weekend.
Meanwhile, it has struck me as odd that identify prints different formats for the histogram.
The first was printed as:
and the second was:40000: (255, 0, 0, 0) #FF0000 red
The first suggests that it is being printed by a Q8 version of IM whereas the second is Q16. Do you have a Q8 version of IM on your system that might be being linked in when doing a static link?40000: (65535, 0, 0,65535) #FFFF000000000000 rgba(255,0,0,1)
Pete
Re: Odd issues when compiling on windows
Pete, you are correct that the first one was with Q8. But Q16 produces similar results:el_supremo wrote:Mikko,
I'll try to do that on the weekend.
Meanwhile, it has struck me as odd that identify prints different formats for the histogram.
The first was printed as:and the second was:40000: (255, 0, 0, 0) #FF0000 redThe first suggests that it is being printed by a Q8 version of IM whereas the second is Q16. Do you have a Q8 version of IM on your system that might be being linked in when doing a static link?40000: (65535, 0, 0,65535) #FFFF000000000000 rgba(255,0,0,1)
Pete
Code: Select all
Image:
Format: png (Portable Network Graphics)
- Hide quoted text -
Class: DirectClass
Geometry: 100x100+0+0
Type: Bilevel
Endianess: Undefined
Colorspace: Gray
Channel depth:
Gray: 1-bit
Channel statistics:
Gray:
Min: 0 (0)
Max: 0 (0)
Mean: 0 (0)
Standard deviation: 0 (0)
Colors: 1
Histogram:
10000: #000000000000 none
Rendering intent: Undefined
Resolution: 72x72
Units: Undefined
Filesize: 0b
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: gray74
Transparent color: none
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Signature: 9a413b131ecf0ccfb02a837ddb33766d8604cc00da7937b79bd363b53c8d7d86
Tainted: True
User time: 0.010u
Elapsed time: 0:01
Pixels per second: 195.307kb
Version: ImageMagick 6.3.3 04/21/07 Q16 http://www.imagemagick.org
The imagick code to create this one:
Code: Select all
<?php
$im = new Imagick();
$im->newImage( 100, 100, new ImagickPixel( "transparent" ) );
$im->setImageFormat( "png" );
$id = $im->identifyImage( true );
echo "<pre>";
var_dump( $id['rawOutput'] );
?>
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Odd issues when compiling on windows
Hi Mikko,
Sorry, I forgot all about trying a static compile for you.
It's probably too late to help you now but I just recompiled my test code statically and it produces a transparent image.
Pete
Sorry, I forgot all about trying a static compile for you.
It's probably too late to help you now but I just recompiled my test code statically and it produces a transparent image.
Pete
Re: Odd issues when compiling on windows
el_supremo,
Good to hear! I'll do some tests today!
Good to hear! I'll do some tests today!
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: Odd issues when compiling on windows
I still don't get it right.
Here is the Visual Studio project: http://valokuva.org/outside-blog-conten ... agickTest/
Here is the generated image:
I don't really see what I am doing wrong here. The image is shown as black in just about any viewer I try.
Here is the Visual Studio project: http://valokuva.org/outside-blog-conten ... agickTest/
Here is the generated image:
I don't really see what I am doing wrong here. The image is shown as black in just about any viewer I try.
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org