Open Rjaat opened 6 months ago
Hello @Rjaat, I'd guess your TIFF is not using 0-65535 for black to white. When it's converted to 8-bit PNG, it looks black but isn't.
You'd need to share a sample source image before anyone could say more.
Are you sure you need that huge overlap?
Thanks @jcupitt for your reply.
png tile information:
Width 1280
Height 1280
Data type UInt16 - Sixteen bit unsigned integer
GDAL Driver Description PNG
While making chunk of 4 band 16bit images the png tiles also generated in 16bit format which is not being rendered by openseadragon viewer. The same is also true when I have 3 band 16 bit image.
In another scenario where I have 8 bit RGB images everything works fine.
Yes, we need 50% overlap in our scenario
As I said, it seems to work for me. You need to share a sample image so I can try to reproduce your problem.
For example, I can take this sample RGBA image:
Make a 16-bit, four band TIFF like this:
vips colourspace biglion.png x.tif rgb16
dzsave
like this:
vips dzsave x.tif x --suffix .png --tile-size 640 --overlap 320
And I see tiles like this:
$ vipsheader x_files/11/1_1.png
x_files/11/1_1.png: 1280x1280 ushort, 4 bands, rgb16, pngload
Which seems correct.
Oh, do you want it to write 8-bit PNG tiles? You need to convert before dzsave
, perhaps:
image = pyvips.Image.new_from_file(image_path, access='sequential')
image \
.colourspace('srgb') \
.dzsave(
"basename", # Base name for the output files
suffix=".png", # Sets the format of the tiles; use '.jpg' for JPEG tiles
overlap=320, # The overlap between tiles; adjust as necessary
tile_size=640 # The size of each tile in pixels
)
Are you sure you need random
? I think sequential
should work, even with very large overlaps, and will be much faster.
I have a 4 band 16 bit tiff image and trying to create .png tiles of that image using below code:
in the process, tile gets created but they comes with black canvas. same approach works fine with 8bit RGB images.
anyone who faced the similar issue, or have any suggestion..... help please!!! Thanks in advance