Would like to know little bit insight why one image size is increased and other one decreased?
See original GitHub issueHello there, I have downloaded two .tiff images from cytomine website:
- https://cytomine.com/collection/hsm0170/400-human-ileons (it’s a huge image 158 GB )
- https://cytomine.com/collection/uliege001/cat-rectum (size 847 Mb) After that, I converted them into ome.tiff using the below code (bcoz bioformat was unable to read these image resolution layers).
def tiles(stack, tileshape):
for y in range(0, stack.shape[0], tileshape[0]):
for x in range(0, stack.shape[1], tileshape[1]):
yield stack[y: y + tileshape[0], x: x + tileshape[1]]
with tifffile.imread(input_path, aszarr=True) as store:
group = zarr.open(store, mode='a')
assert isinstance(group, zarr.Group)
with tifffile.TiffWriter(output_path + f'HSM0170.ome..tiff', bigtiff=True) as tiff:
start_time = timeit.default_timer()
for r in group.keys():
stack = group[r]
width = stack.shape[0]
length = stack.shape[1]
# assert stack.ndim == 3 # YXC
a = tiles(stack, (stack.chunks[0], stack.chunks[1]))
options = {'tile': (stack.chunks[0], stack.chunks[1]), 'compression': 'JPEG'}
tiff.write(tiles(stack, (stack.chunks[0], stack.chunks[1])), shape=stack.shape,
dtype=stack.dtype, **options)
end_time = timeit.default_timer()
total_time = float(end_time - start_time)
print(total_time)
It got converted and I receive generated image first image size was increased to 247.2 GB and the second image size was decreased to 713.5 MB. I want to know a little bit of insight detail why the first image size is increased and the second image size is decreased while applying the same code. Which parameter is crucial while converting, is it jpeg quality?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Always Up-To-Date Guide to Social Media Image Sizes
Make sure that you are choosing dimensions based on where you want the majority of viewers to see your image. Learn more about...
Read more >Resizing images for the web - ALL you need to know
Resizing images for the web - In this article, we will look at digital imaging concepts to do with resolution, image size and...
Read more >Organic Reach is in Decline—Here's What You Can Do About It
Never take a one-size-fits-all approach to social media marketing, especially with organic content. To reach the most people, organic posts need to be...
Read more >10 Easy Ways to Boost Your Instagram Reach - Buffer
Here're 10 simple tactics to use the Instagram algorithm to your advantage and increase your Instagram reach in the algorithmic-feed world.
Read more >Everything you need to know to write effective alt text
Learn how to write meaningful alternative text (alt text) for images, charts, and more.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For pyramidal OME-TIFF you have to reserve subifds for all subresolutions when writing the base/first level.
This should work, although it will probably take several hours to decode and compress several terabytes of image data:
There was another issue in the code. You need to iterate over the zarr groups in the correct order
for i, r in enumerate(tifffile.natural_sorted(group.keys())):
.