Is there a size limitation of view.save_image?

edited July 2014 in Ruby Scripting
KLayout: 0.23.4 and 0.23.5, 64-bit version.
Windows: 7 64-bit

In using the Screen Shot with Options, screenshot.lym, Ruby Module, I seem to have found there is a limit to how large an image can be specified. Is there a limitation to the view-save_image command that can be overcome?

I have an 4000 um x 3000 um layout. If I output an image of 8000 pixel x 6000 pixel, it goes fine.

If I specify an image larger than this, KLayout stops working, Windows indicates that KLayout has stopped working and suggests closing it.

I've tried much larger outputs too, selecting a size of 0.1 um/pixel. This uses all possible memory on the machine (it's 16 GB RAM and 24 GB Page File) and runs, and runs, and runs ... I have yet to let it run long enough to finish or stop working.

Looking at my notes from long, long ago, I used to use the following Ruby command, which ran without issue.
RBA::Application.instance.main_window.current_view.save_image("D:/x.png",10000,10000)

Any thoughts?
Thanks.

Comments

  • edited November -1

    Hi,

    I just ran the command you mentioned with 15k x 15k pixels successfully on Linux, so I can't confirm there is a general issue. It took a couple of seconds with a small layout. It will be more for a bigger layout of course.

    There appears to be a hard limit for images at 16k pixels inside Qt's QImage class but up to that point it should work.

    I see some potential reasons for the failure:

    • There may be an issue with the image encoders. Maybe you can try using ".jpg" to check whether it's the PNG encoder.
    • You can try to disable bitmap caching (File/Setup: Display/Optimization). Bitmap caching may require more memory for higher resolution.
    • Please check whether you have enabled oversampling (File/Setup: Display General). That further increases the memory footprint.

    Regards,

    Matthias

  • edited November -1
    Thanks for the ideas. Indeed, I have oversampling and caching enabled. After I turned those off, I was able to output an image 25,000 x 18,750 pixels ... seems to exceed the 16k hard limit?

    I tried changing the encoder, but no matter what I put for a file extension in the dialog, it always outputs a PNG file. If I put E:\file.jpg, it makes the file file.jpg, but it is actually a PNG image file. I've tried E:\file.bmp too.

    If you want me to try additional encoders, let me know. Otherwise, looks like the oversample and cache were my issues.

    Thanks.
  • edited July 2014

    Oh sorry ... you're right. Output images are always PNG, irregardless of the suffix.

    So there's no way to change the encoder right now. But maybe that is not the reason anyway.

    The hard limit may be bigger on a 64bit machine (I'm running 32bit Linux right now). 16k*16k images with 32bit resolution correspond to 1G memory and that may be the reason why I did not get further. I recall one copy is made internally and the 1G required temporarily for that brings it close to the process size limit.

    So if you have 64bit it's probably just a matter of main memory how far you can go.

    Best regards,

    Matthias

Sign In or Register to comment.