pdf-reader icon indicating copy to clipboard operation
pdf-reader copied to clipboard

How to properly extract Adobe's CMYK JPG image?

Open esergion opened this issue 7 years ago • 1 comments

Hi, thanks for the gem!

I'm trying to extract images from different pdfs and faced with the inverted colors of CMYK JPG images: example pdf: https://drive.google.com/open?id=14plEpWzn3LVpuLte5XEZ5IsAEPr_cF4o extracted image: https://drive.google.com/file/d/1EeJ7hZojLXlG9IpJDdJGvirP1qvb1znb/view?usp=sharing code: https://gist.github.com/esergion/3bac6d289c3487a4fda546e857b60fdf stream hash:

> stream.hash
=> {:BitsPerComponent=>8, :ColorSpace=>:DeviceCMYK, :Filter=>:DCTDecode, :Height=>678, :Interpolate=>true, :Length=>177085, :Subtype=>:Image, :Type=>:XObject, :Width=>1024}

According to pdf spec there should be /Decode array with mappings, so, please tell, how to apply those swapped min and max values to invert colors back?

Thanks for your time

esergion avatar Apr 19 '18 20:04 esergion

@esergion - you're gist is gone, can you edit?

allcentury avatar Nov 21 '19 18:11 allcentury