LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create huge size PNG file with drawing?


@Jaeryul-Gosan wrote:

wiebe@CARYA  작성:

Oh boy. This one isn't easy.

 

Couldn't let it go, even sitting inside during my holydays (procrastinating filling in last weeks hour sheets 😁).

 

The attached library creates a PNG with a background color, and then lets you manipulate pixels.

 

The example 'draws' random circles, by looping over each pixel, and checking if it's in or out. this is very inefficient, but should work for an example. It would make more sense to take each circle's center, and draw a circle around it... Or use Breshenham's circle algorithm...

 

After that, the zlib CRCs and the idat PNG chunk CRC needs to be recalculated.

 

This seems to work for large PNGs. I've tested 100000X1000. Don't expect any speed though. Looping over the pixels takes for ever! Well, several minutes anyway.

 

I'm surprised most tools seem to handle 100000X1000 pixels just fine. LabVIEW doesn't allow it, although that could be a CRC error (LabVIEW is picky on the CRC, while other programs simply ignore CRC errors).

 

To go to 200000X8000, another threshold needs to be crossed. The size crosses the 32 bit barrier. That means it won't fit one idat chunk... It won't be too hard to modify the given code though. 

 

I can't say everything was mapped to specification (can't find a description of the deflate header). I'm sure there will be issues.

 

Have fun!


How can I understand your program?
Do I need to learn more about the PNG file format?


You'd need to study the PNG format. But most of the ground work has been done.

 

We now have lines in deflate in zlib in PNG chunk. To go past the 4GB barrier, you'd also need more than 1 PNG chunk. The lines, deflate and zlib data can simply cross the PGN chunk.

 

So you'd need to manage the CRCs, headers and footers of parts.

 


@Jaeryul-Gosan wrote:

I was trying to combine files separated into BMP files rather than PNG files, but the file size header is 4 bits, so files up to 4 GB can be made with standard headers. Because of this, I try to use a format other than the BMP format.

That would make BMP useless... Unless maybe if you can use greyscale. That would reduce the size to 25% of RGBa...

 


@Jaeryul-Gosan wrote:
So, after learning about the format, do I have to make an encoder and a decoder?

You haven't told us anything about why you need this.

 

If you want to visualize points with sizes in LV, I'd not use a picture format at all.

 

Simply store the coordinates, and display them in an XY Graph, Picture control or graph picture overlay.

 

You have a 'sparse image', and you're storing it in a 'dense image'.

 

The only reason for storing this in an image format, is for external programs. If you want to use this information in LV only, an image format seems very inconvenient. 

Message 41 of 41
(237 Views)