IsBlank modifies image "in-place"

Discussions about image processing and document imaging.
Post Reply
Username
Posts: 16
Joined: Wed Jul 18, 2012 12:11 am

IsBlank modifies image "in-place"

Post by Username » Tue Sep 25, 2012 4:40 pm

IsBlank() modifies the image - this is unacceptable. When I pass 8 bit image to it, after execution of IsBlank and saving the image, now it is suddenly 24 bit and about 3 times bigger compared to real LZW 8 bit image. This is a very simple code that can reproduce the problem (all crazy checks for GdPictureStatus are omitted for brevity):

Code: Select all

GdPictureImaging img = new GdPictureImaging();
GdPicturePDF pdf = new GdPicturePDF();

pdf.LoadFromFile(@"C:\Input.pdf", false);
pdf.SelectPage(1);

int renderedImageId = pdf.RenderPageToGdPictureImage(300, true);
img.ConvertTo8Bpp216(renderedImageId);
// Commenting IsBlank call produces different C:\Out.tif image
img.IsBlank(renderedImageId);
img.SaveAsTIFF(renderedImageId, @"C:\Out.tif", TiffCompression.TiffCompressionLZW);

img.ReleaseGdPictureImage(renderedImageId);
img.Dispose();
pdf.CloseDocument();
pdf.Dispose();

When I execute such code, I expect that the resulting file "C:\Out.tif" will be 8 bit (because of img.ConvertTo8bpp216 call) but it is not - when I see properties for the file, it says "24 bit LZW" and in my case the file size is about 830 KB. If I comment the line that calls IsBlank and leave all other code intact, the resulting file properties are "8 bit LZW" and file size is about 340 KB.

Is it by design (modifying original image in order to determine if it is blank) or it is a bug in GdPicture ? Could it be fixed for next release and when it will happen ?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: IsBlank modifies image "in-place"

Post by Loïc » Tue Sep 25, 2012 4:58 pm

Hello Username,

You are right, this is not a normal behavior. The problem has been fixed for the next 9.2.3 release.

Kind regards,

Loïc

Username
Posts: 16
Joined: Wed Jul 18, 2012 12:11 am

Re: IsBlank modifies image "in-place"

Post by Username » Tue Sep 25, 2012 5:10 pm

That was really fast response...

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: IsBlank modifies image "in-place"

Post by Loïc » Fri Sep 28, 2012 3:52 pm

New version available fixing the issue. See: https://www.gdpicture.com/download/downl ... urenet.php

Hope this helps!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests