question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'gdouble' is invalid or out of range for property 'xres'

See original GitHub issue

When working with medical slides, the resolution is often specified in mm or even nm scale. resunit only accepts cm and inches, so by creating a WSI using tiffsave the values becmoe very small:

slide.tiffsave('slide.tiff', compression='jpeg', Q=80, tile=True, tile_width=128, tile_height=128, pyramid=True, depth=3,
               xres=0.00002333, yres=0.00002333, resunit='cm')

The values fall back to 28.3465 pixels/cm with a warning:

GLib-GObject-WARNING **: 17:22:50.793: value "0.000023" of type 'gdouble' is invalid or out of range for property 'xres' of type 'gdouble'

GLib-GObject-WARNING **: 17:22:50.793: value "0.000023" of type 'gdouble' is invalid or out of range for property 'yres' of type 'gdouble'

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jcupittcommented, Oct 6, 2022

Huh you’re right, the tiff saver also clips the resolution:

        /* Don't write mad resolutions (eg. zero), it confuses some programs.
         */
        TIFFSetField( tif, TIFFTAG_RESOLUTIONUNIT, wtiff->resunit );
        TIFFSetField( tif, TIFFTAG_XRESOLUTION, VIPS_FCLIP( 0.01, wtiff->xres, 1000000 ) );
        TIFFSetField( tif, TIFFTAG_YRESOLUTION, VIPS_FCLIP( 0.01, wtiff->yres, 1000000 ) );

That’ll need changing too. It looks like there’s no easy workaround, unfortunately. We should make this change as a bugfix for 8.13.

The tiffsaver writes the same metadata for all pyramid levels, so you’ll see the same resolution. Imagine if you were printing the pyramid levels next to each other: would you want the levels to all be printed as the same size on the paper, or would you like the smaller levels to be smaller? It depends.

There’s no single correct answer, so libvips avoids automatic resolution changes.

0reactions
karraycommented, Oct 10, 2022

Yes, I think I solved my problem. Your comment from another discussion helped me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Height of the image become 0 during the resizing · Issue #2653
GLib-GObject-WARNING **: 12:34:55.444: value "nan" of type 'gdouble' is invalid or out of range for property 'vscale' of type 'gdouble' ...
Read more >
GLib-GObject-WARNING **: value "-0.039333" of type ...
GLib-GObject-WARNING **: value "-0.039333" of type 'gdouble' is invalid or out of range for property ... Too many error messages in the system ......
Read more >
VipsForeignSave - libvips
Write an image to a file in WebP format. By default, images are saved in lossy format, with Q giving the WebP quality...
Read more >
Diff - 4b29fe6^! - platform/system/core - Git at Google
property name is updated. ... &immediate)) { + o4(0xE2800000 | immediate); // add r0, r0, #offset + } else { + error("structure offset...
Read more >
MickyMike/large_c_corpus · Datasets at Hugging Face
free(fds); fds = NULL; goto out; } fds = tmp; } debug("Found an alias for the ... atoi(Buffer); if (index > max) FatalError("Named...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found