Hi,
I hope I'm reporting this in the right place (and it's not a long squashed
bug, I couldn't find anything on it.) I tried at the Magick++ support forum
referenced here <http://www.imagemagick.org/Magick++/> but it does not seem
to be working.
The bug ocurrs when you use image.crop() on an image and then save a PNG. I
first verified it on 6.2.4 (standard for Debian Gutsy). Then I installed
6.4.1-1 from source hoping it would go away, to no avail. I just hope I'm
not doing something dumb.
// This is a simplified version that reproduces the bug.
// I reproduced it with several images my program works on
// The image in question is a 1300x2004 image, I'm trying to
// crop out a region on the right side of it.
#include <cstdio>
#include <Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main(int argc,char **argv) {
Image image, cur;
image.read( "browse4.png" );
cur = image;
cur.crop( Geometry(30,1960,1267, 0) );
cur.modifyImage(); // Added this hoping the bug would go away by using it.
cur.quality(100);
cur.write( "out.png" );
return 0;
}
In this case, in.png is a 24bit png file with an alpha layer (an image
created by Inkscape 0.45, which seems to be using gtk_pixbuf for writing the
PNG.) Everything works great if I try to open out.png with a program that
uses libpng (like XV.) When I try to open it in GIMP 2.4.2 I get the message
"The PNG file specifies an offset that caused the layer to be positioned
outside the image." The image which is then displayed is the correct width
and height but is otherwise blank. The bug also appears in PerlMagick.
#!/usr/bin/perl
use strict;
use Image::Magick;
my $img = new Image::Magick;
$img->Read("browse4.png");
my $copy = $img->Clone();
$copy->Crop(geometry=>'33x1960+1267+0');
$copy->Write("out.png");
Same thing in RMagick as well:
#!/usr/local/bin/ruby
require 'RMagick'
include Magick
img = Magick::Image::read("browse4.png").first
# 33x1960+1267+0
cur = img.crop(1267, 0, 33, 1960)
cur.write "out.png"
Which means it's probably an ImageMagick bug? Is this a problem with the PNG
encoder? How do I remove the offset? I'd gladly provide the PNG in question,
although it ocurrs on any PNG I tried.
Peace,
Jonathan Jeffus
Psylus Development, LLC.
_______________________________________________
Magick-bugs mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-bugs