Reputation: 3563
I'm building an app to process single page tif(f)
files and batch them into pdf's using PDFSharp. Running into issue with certain files where they will open or process but only as a black page. Seems to be limited to the greyscale or color images. I know they are not corrupt because they open in third party ISV application. They however seem to be compressed using a pretty obscure algorithm. So far i've tried -and failed- to open them with:
When I run the ImageMagick Identify
command I get the following:
identify: compression not supported
The only thing i've been able to find so far that will open them is Brava!Desktop. This however is a commercial app and doesn't seem to take commands for automating this conversion process - which is what I need.
Does anyone know what format this is in or how I would go about about rendering it properly in .net.
Additional EXIFTOOL info exiftool.exe Black.tif -v 5
Thankyou too fmw42 for bringing that tool to my attention !:
| 0) SubfileType = 2
| 1) ImageWidth = 2534
| 2) ImageHeight = 3323
| 3) BitsPerSample = 8 8 8
| 4) Compression = 34712
| 5) PhotometricInterpretation = 2
| 6) StripOffsets = 228
| 7) Orientation = 1
| 8) SamplesPerPixel = 3
| 9) RowsPerStrip = 3323
| 10) StripByteCounts = 11742587
| 11) XResolution = 300 (300/1)
| 12) YResolution = 300 (300/1)
| 13) PlanarConfiguration = 1
| 14) ResolutionUnit = 2
| 15) PageNumber = 0 0
Upvotes: 0
Views: 1367
Reputation: 9437
Try (using Python):
tifffile, with imagecodecs installed, can read the image into a numpy array, which can then be further processed:
from matplotlib import pyplot
import tifffile
im = tifffile.imread('black.tif')
pyplot.imshow(im)
pyplot.show()
Open the file in binary mode, seek to StripOffsets, read StripByteCounts bytes, and write the buffer to a .jp2 file, which can be opened with IrfanView etc:
with open('black.tif', 'rb') as fh:
fh.seek(228)
im = fh.read(11742587)
with open('black.jp2', 'wb') as fh:
fh.write(im)
Upvotes: 2