Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

File Size When Export to PNG #22

Closed
raniaamina opened this issue Aug 27, 2019 · 11 comments
Closed

File Size When Export to PNG #22

raniaamina opened this issue Aug 27, 2019 · 11 comments

Comments

@raniaamina
Copy link

Hi, very thanks for this great tools.
I've a bit problem when i try to export sozi html file to png sequence. Each png has 8 MB size, some of them.are blank (only white) image, so i think it so big for blank image. Is there any way to set each png in minimum image size?

Thank you

@ejvindh
Copy link

ejvindh commented Aug 27, 2019

See the options-list: https://github.com/senshu/Sozi-export
You can set the height, witdh and resolution.

@aumouvantsillage
Copy link
Collaborator

The PNG rendering function also accepts a quality parameter that is set to 100% in the code at the moment.

Initially, the PNG export was only an intermediate step before converting to video, so it made sense to keep the highest quality at the input of the video encoder.
For users who don't want to convert to video, I agree that the quality setting should be available as a command-line option.

@raniaamina
Copy link
Author

So, how should my command written?
I usually use

sozi-to-video file.sozi.html -o ./png -W 1920 -H 1064 -i

Yes, i get different height size when i type 1080, so i use value 1064 to get value 1080 of height

@ejvindh
Copy link

ejvindh commented Aug 28, 2019

Sorry, I now realize that the options don't affect the temporally created png's. You will thus either have to hack the code pointed out by @SENSHU, wait for someone else doing it (since @SENSHU has acknowledged you question as a relevant improvement), or maybe use sozi-to-pdf, which will give you the option of downsizing the pages.

Alternatively you downscale the files with a commandline-tool -- in linux that might be "convert":
https://askubuntu.com/a/271797

@raniaamina
Copy link
Author

Yes, i did it manually before
Here the final motion that i create
https://www.youtube.com/watch?v=CMoF3KGevcg

Btw, next month i'll talk about Sozi in openSUSE.Asia Summit :")

@aumouvantsillage
Copy link
Collaborator

I'm reopening this issue: I think it would be a good thing to add parameters to better control image resolution and quality.

@sonejostudios
Copy link

This might be related to this as well, since IMO the PNG-export is the most important function for animators:

#15 (comment)

@aumouvantsillage
Copy link
Collaborator

From my experiments so far, the quality parameter for PNG files has no effect on file size. All generated images have exactly the same size, regardless of their content and the value of the quality option.

For the record, the API documentation of PhantomJS tells that the quality option does not actually affect the image quality of PNGs but should have an effect on the compressed size.

PhantomJS being deprecated, I'm afraid we cannot expect any improvement on this topic in the near future.

@aumouvantsillage
Copy link
Collaborator

i get different height size when i type 1080, so i use value 1064 to get value 1080 of height

I found a question about a similar issue.
I observe that the generated PNGs have a margin, which explains why they are bigger that expected.

@aumouvantsillage
Copy link
Collaborator

From my experiments so far, the quality parameter for PNG files has no effect on file size.

My bad. After fixing an error in my code, I could reduce the image file size of my example from 3Mb to 30 kb.

@aumouvantsillage
Copy link
Collaborator

I have pushed a fix that adds a command-line option -c to set the PNG compression level.
0 is the lowest compression level (produces bigger files), 100 is the highest and the default (produces smaller files).

I have also fixed the image height issue based on the observation that PhantomJS always adds 16 pixels to the window height.

The new version is published to NPM as Sozi-export 19.09.14.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants