Page 1 of 1

BlobToImage doesn't work

Posted: 2009-09-14T04:30:35-07:00
by Biene_Maja
I cant get BlobToImage() to work
My Code:

Code: Select all

my $image=Image::Magick->new();
$image->Read('pics/example.bmp');
$image->Set(magick=>'Gray');			# My images are all 8 bit Gray BMP's
my $blob=$image->ImageToBlob();
my @grayvals = unpack "C*",$blob;		

foreach my $element(@grayvals)                       # Setting all pixel to 0 for testing
{
  	$element = 0;
}

$blob=pack "C*",@grayvals;
$image->BlobToImage($blob);

$image->Write('example_out.bmp');
Doesn't work - the image looks the same as before.
If i use a second Image-Object to write the blob to - nothing happens at all.
The ImagetoBlob function works, because i get the right gray-values.

Thank you for any help :)

Re: BlobToImage doesn't work

Posted: 2009-10-01T09:55:40-07:00
by gnembon
Hi, I think you suffer from the same problem, that I have. (viewtopic.php?f=7&t=8228) BlobToImage doesn't overwrite previous image but add a new image to the collection. Try to save all images and see if by any chance you get your result in subsequent images. If you don't need Exif data - this shouldn't be a problem (it only eats more RAM), however, metadata are not inherited from the parent image.