Convert To BW
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
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.
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.
Convert To BW
I have an IIXC_Page object that is a gray scale image. I need to convert it into a black and white image.
Here is what I'm using currently
var
APage: IIXC_Page;
begin
APage.ConvertToFormat(PageFormat_1Indexed);
APage.Set_FmtInt(FP_ID_ITYPE, 1);
APage.Set_FmtInt(FP_ID_BPP, 1);
However, the last line that sets the BPP to 1 inverts the image so what was white is now black.
Is this the correct way to covert a gray scale image to black and white? If not, how would you suggest I accomplish this with the IIXC_Page object?
--Jeff
Here is what I'm using currently
var
APage: IIXC_Page;
begin
APage.ConvertToFormat(PageFormat_1Indexed);
APage.Set_FmtInt(FP_ID_ITYPE, 1);
APage.Set_FmtInt(FP_ID_BPP, 1);
However, the last line that sets the BPP to 1 inverts the image so what was white is now black.
Is this the correct way to covert a gray scale image to black and white? If not, how would you suggest I accomplish this with the IIXC_Page object?
--Jeff
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Hello Jeff,
Are you using the Editor SDK or Core API?
Cheers,
Alex
Are you using the Editor SDK or Core API?
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Convert To BW
I need to be able to make this conversion via the API in code. Again using the IIXC_Page object.
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Hello Jeff,
Can you please give us a full sample, that does this conversion and also, that will give us the same presentation of the result that you have (to investigate the inverse part), because this code alone is not enough to make a correct judgement.
Cheers,
Alex
Can you please give us a full sample, that does this conversion and also, that will give us the same presentation of the result that you have (to investigate the inverse part), because this code alone is not enough to make a correct judgement.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Convert To BW
I'm having a hard time finding the sample file that wasn't working.
Can I just ask what calls you would make to turn a GrayScale or Color image into a BW image?
--Jeff
Can I just ask what calls you would make to turn a GrayScale or Color image into a BW image?
--Jeff
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Hello Jeff,
We've implemented the IIXC_Page::ReduceColorsFixedPalette method that will allow you to set the needed colors palette (in your case the Black and White colors) and make the image BW. This will be available from the next release (326).
PS: No release ETA yet.
Cheers,
Alex
We've implemented the IIXC_Page::ReduceColorsFixedPalette method that will allow you to set the needed colors palette (in your case the Black and White colors) and make the image BW. This will be available from the next release (326).
PS: No release ETA yet.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Convert To BW
Ok The call is defined as
function ReduceColorsFixedPalette(pFixedPalette: PSafeArray; nDitherMethod: IXC_DitherMethod): HResult; stdcall;
Can you help me with what to set for pFixedPallette to turn the page into a BW image
APage.ReduceColorsFixedPalette(???, Dither_none);
Also, how does ReduceColorsAdaptive compare to ReduceColorsFixedPalette?
Again, I'm using Delphi.
--Jeff
function ReduceColorsFixedPalette(pFixedPalette: PSafeArray; nDitherMethod: IXC_DitherMethod): HResult; stdcall;
Can you help me with what to set for pFixedPallette to turn the page into a BW image
APage.ReduceColorsFixedPalette(???, Dither_none);
Also, how does ReduceColorsAdaptive compare to ReduceColorsFixedPalette?
Again, I'm using Delphi.
--Jeff
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Hello Jeff,
You should have something like this:
I will try to write a code sample tomorrow.
Cheers,
Alex
You should have something like this:
Code: Select all
static RGBQUAD bw_palette[] = {{0, 0, 0, 0}, {0xFF, 0xFF, 0xFF, 0}};
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Convert To BW
Yes. A Delphi Code sample would be great. Again, lookiing for the optimal way to convert an image to black and white.
You have a APage.ToGrayscale procedure currently. Maybe you should add APage.ToBW
Thanks again.
--Jeff
You have a APage.ToGrayscale procedure currently. Maybe you should add APage.ToBW
Thanks again.
--Jeff
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Convert To BW
Hello Jeff,
I've update a description of this method here:
https://sdkhelp.pdf-xchange.com/vi ... xedPalette
And also, I've made a working sample (4.12. ChangeAllOfTheImagesToBlackAndWhite) in the CoreAPIDemo project available from here:
https://github.com/tracker-software/PDFCoreSDKExamples
Cheers,
Alex
I've update a description of this method here:
https://sdkhelp.pdf-xchange.com/vi ... xedPalette
And also, I've made a working sample (4.12. ChangeAllOfTheImagesToBlackAndWhite) in the CoreAPIDemo project available from here:
https://github.com/tracker-software/PDFCoreSDKExamples
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ