Forum rules DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
I'm essentially trying to append one 5 page .tif file to another with the code below. However, the InsertPage call below is not working. Can you tell me what I'm doing wrong.
Hi jeffp.
Not exactly, but this is one of two options. Each IIXC_Page may belong to only one image or be standalone, and only standalone pages may be inserted to images. By default when loading image all pages from that image belongs to it (this is done to prevent decode entire image during load when you need only one page from it or even only information about pages). When you create new page or clone existing - resulting page became standalone. Also, you may call IIXC_Image::RemovePage - it will make page standalone and remove it from image pages list (but not from source file until you save changes). So if you need copy of page you should call clone, otherwise it will be better to call IIXC_Image::RemovePage.
HTH.
Victor
Tracker Software
Project manager
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Thanks Lzcat. That makes sense to me know. I'll use RemovePage and Clone accordingly.
As a follow up, I'm doing more with your image calls now and have a few more questions.
[1]
If I load a .tif file into a IIXC_Image, how can I convert it from color to black and white?
[2]
If I load a multipage .tif file into a IIXC_Image, how can I save it out in .jpg format with each page being a separate file?
[3]
Where can I set compression options? Let say I load an uncompressed .tif and I now want to save it out with LZW compression.
[4]
What is the IIXC_Image.FormatID property. It seems it may help in the items above, but it doesn't seem to be documented.
[5]
After I run a cleanup routine line Deskew on a page, do I need to do anything to apply the changes before I save it back out to file? And what are the values for the nFlags parameter in Deskew?
This isn't working. There must be something I'm missing in the code below. Take a look at the results in the attached zip file. I'm trying to convert the Color.tif file into BW and Grayscale but they don't turn out.
[2-4] Here's how the code would look like: https://gist.github.com/Polaringu/46461 ... 42fc39038b
Though you'll need to use our ImagesTest utility to know all of the images format parameters and values (see the attachment).
When you launch it, go into the "View \ Encoders List..." menu. Then the "Encoder's Features" dialog should open.
There you will see all of the possible values for each format. Compare it with the code I provided and use that accordingly.
Here's my convert to BW code. It works great for color images, but if I try to convert the attached grayscale.tif image using the code, it turns it into a completely black image.
procedure TMyIMG.ConvertToBW;
var
i, APageCount: Cardinal;
iPage: IIXC_Page;
begin
if Assigned(FDoc) then
begin
APageCount := GetPageCount;
for i := 0 to APageCount - 1 do
begin
FDoc.GetPage(i, nil, iPage);
iPage.ClearFormatParams;
iPage.Set_FmtInt(FP_ID_FORMAT, FMT_TIFF_ID);
iPage.Set_FmtInt(FP_ID_ITYPE, 1); //1=BW
end;
end;
end;
Ok. I've got a really strange issue for you. The code below successfully converts Color.tif to Grayscale.tif.
However, if I run the code twice, the second time the GrayScale.tif comes out completely black.
The code below replicates this by just running the main code twice. Attached is my original Color.tif, but I don't think it has to do with this image. It seems like it is an issue with not clearing out the image object. Is there a call I'm missing to clear the image object when I'm done with it.
If you can, please provide us a small working sample that we can test and debug if the problem occurs. Because right now i don't see a problem from our side.
Well the thing is that we can't recreate this behavior on our side. So the best thing that I imagine would be a new small simple project that converts that image into the grayscale and reproduces invalid behavior on your side. Also, include the debug exe file from your side - maybe it has to do something with your local machine (settings, libraries etc). Because right now we can't help because we can't recreate that behavior that you got.
We managed to reproduce that problem. There seems to be some kind of problem with the tiff encoder when the LZW compression is used. We will try to fix this in one of the nearest future builds. The workaround is to use any other compression type for example:
Just spoke with Sasha and he says that we will try to fix this for build 318 planned for release around the end of June, however Sasha can not guarantee this at 100%. And the suggestion for using other compression methods is meant to be just a temporary workaround while we do the proper fix.
As for the difference, its two entirely different compression types. Deflate uses ZIP which in most cases will give optimal results. Though the result is always input based - some files will give entirely different results.
By the way, the LZW problem is already fixed. We will launch a dev build soon where you can try the fixes.
We will post the links here: https://forum.pdf-xchange.com/ ... 66&t=25943
Also, all of the links and attachments will be updated in that topic when needed, so there always will be a latest version there.