Reading large dimension PNGs Error: Qt cannot read PNG file

40 views
Skip to first unread message

Ak

unread,
Oct 20, 2025, 9:28:31 PMOct 20
to fo...@jsoftware.com
I hope you are all well.

I am having an issue reading some larger dimension  PNG files (30720 x 30720).

I can read the same files in console, but in Qt I get the message:
 
     'Qt cannot read PNG file'

Is this a resources limitation related to the added overhead of running jqt? 

Is there a way to increase the allottable resource amount?

Or is there some other setting I need to adjust that allows me to access the larger PNGs in jqt?


Thank you


Ak

 

Daniikk1012

unread,
Oct 21, 2025, 4:42:55 AMOct 21
to forum, Ak
It appears Qt itself by default limits memory available to the image loader.
In order to load it, you would somehow need to increase that limit, or use another png loading method (If you're using png addon, maybe it has a way to choose a different loader?).
In C++ you would call QImageReader::setAllocationLimit(): https://forum.qt.io/topic/143069/loading-large-images/8
In J you might try to call this method using "cd", as it's a static method, but since it's C++ it's probably mangled, and that mangling is dependent on what compiler was used to compile Qt.
Or create a wrapper DLL in C++ that defines an extern "C" function that calls this method, which will avoid mangling, and then call that from J.
Not a J expert though, maybe there is an easier way I'm missing.
вторник, 21 октября 2025 г. в 06:28:31 UTC+5, Ak:

trx2358...@yahoo.com

unread,
Oct 21, 2025, 6:21:24 AMOct 21
to Digest Recipients
Do you have a link to a public PNG file which displays this error?


Devon McCormick

unread,
Oct 21, 2025, 6:36:01 PMOct 21
to fo...@jsoftware.com
You could create one - if your machine has enough memory - with a statement like this:

   (30720 30720 3?@$256) write_image 'Large.png'

On Tue, Oct 21, 2025 at 6:21 AM trx2358-discord via forum <fo...@jsoftware.com> wrote:
Do you have a link to a public PNG file which displays this error?


To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.


--

Devon McCormick

Flâneur


Ak

unread,
Oct 22, 2025, 4:54:08 PMOct 22
to fo...@jsoftware.com
You can generate a file with the same protocol I use with these instructions.

My apology I don't know your name. Thx for looking at it. 

Ak

NB. This is the protocol I used to cause the error.
NB.  The line causes the error in jqt.
NB.                0 read_sample data_path
NB. This executes in a J-Console Session.
NB.
NB. dimensions-> 30720 30720
NB. image_data -> Image
NB. data_path -> path to storage folder.
NB. set_sample -> Pixel format ARGB format 
NB. write_path/read_path -> storage folder
NB. read_sample -> Read out image_data from selected file from data_path
NB.
NB.                       Write template
NB. This generates a png file of ~700 MB in the path you designate.
NB. Writes a png to the folder called data_folder on the path.
NB.           [string_filename]  write_sample  [image_data]
NB.         
NB.           'big_png_00' write_sample image_data
NB.
NB.                       Read template
NB.           [folder_item_number] read_sample  [data_path]
NB.
NB.           0 read_sample  data_path
NB.          


load 'png'
image_data =: 254{.,(|.128 *"0 2 (#:i.16)),(255 *"0 2 ((16?16){"2 (#:i.16))),(255 *"0 2 (#:i.16)),(128 *"0 2 ((16?16){"2 (#:i.16)))
'u31 u32' =: <.2^31 32
unpak =: u32&|
pak =: unpak&.(+&u31)
set_sample =: [: pak ([: , 256 256 256 256 (#.) _4 ]\ ])"1
data_path =: hostpathsep 'c:/data_folder/'
read_sample =: [: , [: readpng_jpng_  ([: ; [ {  [: {."1 [: dirtree ]) :: (0%00)

     write_sample =: 4 : 0
n=. ('.png',~])&.>(write_path,])&.><x
p=. , set_sample y
n writepng_jpng_ ~(30720 30720 $ p)
)


NB.                   Write
     'big_png_00'   write_sample  image_data

NB.                   Read           This line results in -> QT cannot read PNG file.
   $  0 read_sample data_path
       0 read_sample data_path

bill lam

unread,
Oct 23, 2025, 5:56:18 AMOct 23
to fo...@jsoftware.com
Try disable Qt image routines by

USEQTPNG_z_=: 0
load 'png'
.....

Ak

unread,
Oct 23, 2025, 7:06:39 AMOct 23
to fo...@jsoftware.com
Thank you Bill.

This works.

Ak
Reply all
Reply to author
Forward
0 new messages