Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to view the image (ImageData) as tiff or pdf. #71

Open
connectmedinesh opened this issue Jan 16, 2023 · 3 comments
Open

How to view the image (ImageData) as tiff or pdf. #71

connectmedinesh opened this issue Jan 16, 2023 · 3 comments

Comments

@connectmedinesh
Copy link

Please help me on this,

I was able to open MO:DCA file using your lib and I was successful getting hands on the Image (IOCA) but I don't know to how view the image as tiff or pdf.

The properties I found on the IOCA file using SDFHelper.ipds2sdf and Triplets (BeginSegment, BeginImage,ImageSizeImpl,IDESizeImpl,ImageLUTID, ImageEncodingImpl, ImageData)

getSEGNAME() :null
getOBJTYPE() :255
getVRESOL :2000,
getVSIZE :5000
getHRESOL :2000
getHSIZE :1196
getUNITBASE :0
iDESizeImpl :1
ImageLUTID : 0
getBITORDR :null
getCOMPRID :ConstG4MMR (G4 MMR-Modified Modified READ)
getRECID :1

@connectmedinesh connectmedinesh changed the title How to view the image in pdf. How to view the image as tiff or pdf. Jan 16, 2023
@connectmedinesh connectmedinesh changed the title How to view the image as tiff or pdf. How to view the image (ImageData) as tiff or pdf. Jan 16, 2023
@yan74
Copy link
Owner

yan74 commented Jan 16, 2023

Hi @connectmedinesh,

this looks like a black and white G4 MMR encoded image. You'd need to extract the binary data from ImageData, decompress using G4 MMR and then construct a B/W image from it. I believe there are some old G4 MMR decompressors on the internet.

Hope that helps!
Yan

@connectmedinesh
Copy link
Author

Hi @yan74, Thanks for the prompt response. I was able to decompress the Binary data and now I have the G4 MMR decompressed data. Can you please tell me what do you mean by "construct B/W Image", Can you please give me an idea how to construct a B/W Image or sample code, it would be so helpful.

Java Class : https://github.com/ESCRIBA/lenient-pdf-compare/blob/4dcedec705b70328fa78935e0e2f95a94a89ef8c/src/com/sun/pdfview/decode/CCITTFaxDecoder.java

Method used: public synchronized void decodeT6(byte[] buffer, byte[] compData,int startX, int height)

Thanks in advance.

@yan74
Copy link
Owner

yan74 commented Jan 17, 2023

I guess now you have your black and white pixels represented by bits in that buffer. Construct an empty BufferedImage having the IOCA images width and height and with a b/w or grey color space. Looping over height and width with y and x you would figure out the bit in that buffer that represent the x,y pixel you are currently at. Depending on whether this is 0 or 1 you set a white or black pixel at x,y.

I know this is very rough and high level - there should be some code on the internet on how to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants