TIFF compression changes to LZW

Discussions about document viewing.
Post Reply
lponder
Posts: 3
Joined: Wed Feb 22, 2012 10:57 pm

TIFF compression changes to LZW

Post by lponder » Wed Feb 22, 2012 11:23 pm

I'm evaluating your tools (downloaded just a week ago) for use in our legacy Visual Foxpro 9 application, and they seem to work wonderfully.

However, when I save an image after adding an annotation (redactions, primarily) the resulting file is created with LZW compression, but what is needed is CCITT 4 compression. Below is the code I'm using to create the file (note that I'm using the number 4 to represent TiffCompressionCCITT4):

Thisform.GdViewer.SaveDocumentToTiff('C:\NewTiff.tif', 4)

Can you tell me how to produce the file with CCITT 4 compression? Thanks in advance -

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

Re: TIFF compression changes to LZW

Post by SamiKharma » Thu Feb 23, 2012 12:03 pm

Hi,
Please see:https://www.gdpicture.com/guides/gdpicture/v8/html/con ... aging.html
and choose the type of Tiff compression you want.

Best Regards,
Sami

lponder
Posts: 3
Joined: Wed Feb 22, 2012 10:57 pm

Re: TIFF compression changes to LZW

Post by lponder » Thu Feb 23, 2012 11:33 pm

Thanks for your help; I tried it, but got the same result. I create a PictureImaging object, open an 11Kb TIF file, and display it in the GdViewer:

oPictureImaging = CreateObject('GdPicture.GdPictureImaging')
ImageID = oPictureImaging.CreateGdPictureImageFromFile('C:\OldFile.tif')
GdViewer.DisplayFromGdPictureImage(ImageID)

I then add an annotation, burn it to the page, and attempt to save the image as a TIF file using CCITT4 compression:

GdViewer.addrectangleAnnotInteractive(.T., .F., GdViewer.argbi(255,0,0,0), GdViewer.argbi(255,0,0,0), 0, 1)
GdViewer.BurnannotationsToPage(.T.)
oPictureImaging.SaveAsTiff(ImageID, 'C:\NewFile.tif', 4)

The resulting 574Kb file has LZW compression, not CCITT4. If I then use another tool to "convert" the 574Kb LZW TIF file with CCITT4 compression, the result is a 13Kb TIF file that contains the annotation.

Can you see where I'm going wrong?

Thanks -

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

Re: TIFF compression changes to LZW

Post by SamiKharma » Fri Feb 24, 2012 10:59 am

Hi,

BurnAnnotations function requires a color, meaning the image will be converted to color to set that color of the annotation.
After calling the function you need to make a call to Convertto1bpp which will also fix the compression problem that you have.
The reason is: CCITT is suitable only for 1bpp image. Therefore, if the you try to apply CCITT to a color image the compression will switch automatically to LZW to avoid error.

Best Regards,
Sami

lponder
Posts: 3
Joined: Wed Feb 22, 2012 10:57 pm

Re: TIFF compression changes to LZW

Post by lponder » Fri Feb 24, 2012 4:29 pm

Hi Sami,

That fixed my problem. Thanks for your very timely and accurate support, and for explaining the reason the additional call is needed.

Best Regards -

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

Re: TIFF compression changes to LZW

Post by SamiKharma » Fri Feb 24, 2012 11:08 pm

Hi,
No Problem, Happy to have been able to help you.

Cheers,
Sami

stanlyn
Posts: 25
Joined: Wed Mar 05, 2014 8:29 pm

Re: TIFF compression changes to LZW

Post by stanlyn » Wed Mar 05, 2014 8:47 pm

Hi ,

The link below is not showing... Can you provide another link?

https://www.gdpicture.com/guides/gdpicture/v8/html/con ... aging.html


This was mentioned by Sami in;
viewtopic.php?t=3604#p11919

What I need is the reference for what to give vfp the compression mapping numbers and what they relate to. I think a number of 4 = group4 tiff compression, so where is the mapping for the other options?

Also it could be part of a .h header or #define file, all of which is needed.

Thanks, Stanley

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

Re: TIFF compression changes to LZW

Post by SamiKharma » Wed Mar 05, 2014 9:16 pm

Hi,

The link expired because it is an old post with the documentation of the old version.
The function you are looking for is:
GdPictureImaging.SaveAsTiff

you can find it in our current guide accessible through: guides.gdpicture.com
Just go to the GdPictureImaging class, Methods, Saving Images, and it should be there.

Best,
Sami

stanlyn
Posts: 25
Joined: Wed Mar 05, 2014 8:29 pm

Re: TIFF compression changes to LZW

Post by stanlyn » Thu Mar 06, 2014 3:49 am

Hi Sami,

Not there, I have also noticed you call it a constants file, that converts these long names like "TiffCompressionCCITT4" to a number.

In VFP, I have to use the associated number as the long name generates an error, unless I use the constants or .h header file. I'm trying to locate the file that has all those definitions listed.

The gdPicture supplied VFP sample uses the number 65536, instead of the long name, and all the later docs only refers to it by name.

In Tiff compression, what NAME does the number 65536 represent, and what NUMBER does the name TiffCompressionCCITT4 represent, as well as all the other types? What is LZW, and etc?

I really need the documentation and sample code from the old legacy toolkits as they will contain these missing pieces. There is probably good structured tutorials and sample code for doing the activex stuff in VFP as well. I do know they contain a lot of VB sample code which is a lot easier to convert to VFP that all of your current offerings which is .NET centric. And yes, I know that it is un-supported legacy stuff, but your support also refuses to support the current v10 with any samples and documentation, so I'm trying to get where ever I can.

I believe gdPicture would benefit by making the legacy documentation and samples available online, with a clear "un-supported statement". If it were there, I would be much further ahead in my eval, instead of us wasting each others' time.

Thanks, Stanley

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

Re: TIFF compression changes to LZW

Post by SamiKharma » Thu Mar 06, 2014 11:39 am

Hi,

>>Not there, I have also noticed you call it a constants file, that converts these long names like "TiffCompressionCCITT4" to a number.
Actually it is: https://www.gdpicture.com/guides/gdpicture/GdP ... sTIFF.html

>>In VFP, I have to use the associated number as the long name generates an error, unless I use the constants or .h header file. I'm trying to locate the file that has all those definitions listed.
You could easily find out in code, but here is a list:
TiffCompressionUnknown = 0,
TiffCompressionNONE = 1,
TiffCompressionRLE = 2,
TiffCompressionCCITT3 = 3,
TiffCompressionCCITT4 = 4,
TiffCompressionLZW = 5,
TiffCompressionOJPEG = 6,
TiffCompressionJPEG = 7,
TiffCompressionADOBEDEFLATE = 8,
TiffCompressionNEXT = 32766,
TiffCompressionCCITTRLEW = 32771,
TiffCompressionPACKBITS = 32773,
TiffCompressionTHUNDERSCAN = 32809,
TiffCompressionDEFLATE = 32946,
TiffCompressionAUTO = 65536,

>> your support also refuses to support the current v10 with any samples and documentation, so
There is a dedicated section for code requests on the forum, so we can share with the community: gdpicturenet-samples/

>>I believe gdPicture would benefit by making the legacy documentation and samples available online
It is in the link I sent you in my previous reply, all the previous documentation, please do have another look: guides.gdpicture.com
That being said, the current documentation includes all the previous examples and more.

Sami

stanlyn
Posts: 25
Joined: Wed Mar 05, 2014 8:29 pm

Re: TIFF compression changes to LZW

Post by stanlyn » Fri Mar 07, 2014 7:34 am

Hi Sami,

I surely must be missing something here...

>> You could easily find out in code, but here is a list:

How? I did not see any reference to the list you provided above in the link you provided, https://www.gdpicture.com/guides/gdpicture/GdP ... sTIFF.html or GdPictureImaging class, Methods, Saving Images, so where did you get the list?


>> That being said, the current documentation includes all the previous examples and more.

Not true, I just located the VFP sample form from gdPicture version 5 that I found in a google search, and it is totally different from what is provided in the current version. It covered some areas that the current version skipped, which is good. I need more...

OK, I went to your gdpicturenet-samples/ page and searched "Example requests and code samples" for term "VFP" and got 0 (zero) results. Searched for the term "foxpro" and got only 4 results. That's nothing to the scope of what your toolkit is capable of. I just need to know how to implement it, thus my persistence in finding out how.

I found this reference which returns "page not found" in an article in the gdPicture activex legacy section, which further confirms little documentation available for VFP;
"Yes, into the full package you will find some vfp samples."
"Also, you can see online tutorials from this link: https://www.gdpicture.com/samples/gdpict ... amples.php"

I see some legacy .NET documentation at https://www.gdpicture.com/guides/gdpicture, but no ActiveX stuff.

Thanks, Stanley

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests