- Edited
I tried this:
var reader := ZIPReader.new()
var err := reader.open(path_to_zip)
for file_path in reader.get_files():
if file_path.ends_with("/picture.jpg"):
var buffer := reader.read_file(file_path)
img = Image.new()
img.load_jpg_from_buffer(buffer)
img.save_jpg("/somewhere/else/picture.jpg")
But, the resulting file size is several times bigger than the original picture.jpg (I checked this by extracting the file with an archive manger and checking its size). I am guessing the intermediate step of converting the file into an Image object is what causes this. Is there a better way?
EDIT: Changed the save_png method to save_jpg as this is what I was actually using.