Preserve Quality and BitDepth

Discussions about image processing and document imaging.
Post Reply
DSchlueter
Posts: 3
Joined: Mon Dec 16, 2013 3:19 pm

Preserve Quality and BitDepth

Post by DSchlueter » Mon Dec 16, 2013 3:45 pm

Greetings:
Is there any way to make the toolkit preserve the quality and bit-depth of a loaded image? I am using v10.

Here is a specific scenario:
A document is a multi-page, bitonal tiff at 300 DPI that is compressed via CCITT Group 4 (all pages are the same). After simply loading the tiff and adding a few pixels border to one side, the image is converted into a 128 DPI 24-bit color document and aside from growing a ton in file size, it is now horrible in quality compared to the original.

Code: Select all

            iImageId = this._Toolkit.CreateGdPictureImageFromFile(sImage, true);

            if (iLeft > 0)
            { oStatus = this._Toolkit.AddBorderLeft(iImageId, iLeft, this._Toolkit.ARGB(255, 255, 255)); }

            if (oStatus != GdPicture10.GdPictureStatus.OK)
            { throw new Exception(oStatus.ToString()); }

            oStatus = this._Toolkit.TiffSaveMultiPageToFile(iImageId, sFile, this._Toolkit.GetTiffCompression(iImageId));

            if (oStatus != GdPicture10.GdPictureStatus.OK)
            { throw new Exception(oStatus.ToString()); }

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Preserve Quality and BitDepth

Post by SamiKharma » Tue Dec 17, 2013 12:19 pm

Hi,

This is expected behaviour. The AddBorderLeft method takes a Color object as its third parameter, meaning it could be any color. For images to support colors, they have to be 24 bit images (usually), thus the image is converted internally.
GdPicture does not change the image properties unless the processing function logically requires it to.

Best regards,
Sami

DSchlueter
Posts: 3
Joined: Mon Dec 16, 2013 3:19 pm

Re: Preserve Quality and BitDepth

Post by DSchlueter » Tue Dec 17, 2013 4:21 pm

If you notice, the color that I use is white though. I would like to import a B&W image, add a white border, otherwise keep the image unchanged, and save it as a B&W image with a border added. Is this not possible?

The original image is 300 dpi B&W, it is converted to 118 DPI (typo in the first post) 24-bit color when adding a border, thus when go to save the image, the resulting B&W image is very unreadable compared to the original.

If I cannot use the AddBorder methods, is there another way to add borders to a B&W document without sacrificing the quality of the image from auto-conversion within the engine?

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Preserve Quality and BitDepth

Post by SamiKharma » Wed Dec 18, 2013 10:57 am

Hi,

To get the desired effect all you have to do is convert the image back to 1bpp using ConvertTo1Bpp.
As for the dpi issue, try as I might I could not reproduce the problem, thus I would need the image you are talking about and a sample code to run as is in order to be able to reproduce it.

Best,
Sami

DSchlueter
Posts: 3
Joined: Mon Dec 16, 2013 3:19 pm

Re: Preserve Quality and BitDepth

Post by DSchlueter » Wed Dec 18, 2013 5:12 pm

When bringing up your member profile, the contact area is blank; could you please provide me with the contact information I need to send you an example document? The source code that I use was included as part of the original post.

SamiKharma
Posts: 352
Joined: Tue Sep 27, 2011 11:47 am

Re: Preserve Quality and BitDepth

Post by SamiKharma » Thu Dec 19, 2013 12:48 pm

Hi,

You can attach the image here, if you cannot for privacy or security reasons, and operate with the latest V10 SDK, you can attach it to a support ticket here:
support.orpalis.com

Best regards,
Sami

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest