BlobToImage doesn't work

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Locked
Biene_Maja

BlobToImage doesn't work

Post 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 :)

gnembon

Re: BlobToImage doesn't work

Post 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.

Locked