Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PNG data without saving to file?
#1
Hello,

Is there a way to convert a layer to PNG data, and convert PNG data to a layer, without exporting to a file?
I am trying to send a layer to a local server that accepts base64 encoded PNG data, receive base64 encoded PNG data, then convert that data back into a layer.

My current process is as follows:
> Save layer as PNG (pdb.gimp_file_save) 
> Read the PNG file data
> Convert PNG data to base64 data
> Send base64 data using websocket 
> Receive base64 data
> Write the received data to the previously saved PNG file 
> Load the PNG file as layer (pdb.gimp_file_load_layer)
> Delete PNG file

The closest solution that I have found is to use PIL/Pillow. I have tried installing PIL6.2.2 and earlier versions with GIMP's python but receive the error:
"The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source."


If there is a solution within GIMP, or someone might be able to help me get Pillow to work, I would greatly appreciate it!
I am on Windows 10, using GIMP 2.10.38, and GIMP's Python 2.7.18. Please let me know if there is additional information I should provide.
Thank you for your time!
Reply


Messages In This Thread
PNG data without saving to file? - by nchen - 09-09-2024, 08:44 PM
RE: PNG data without saving to file? - by nchen - 09-10-2024, 12:07 AM
RE: PNG data without saving to file? - by Ofnuts - 09-10-2024, 12:19 AM
RE: PNG data without saving to file? - by nchen - 09-10-2024, 05:53 PM

Forum Jump: