Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same filename for input and output doesn't work #20

Closed
robryk opened this issue Jan 13, 2017 · 4 comments
Closed

Same filename for input and output doesn't work #20

robryk opened this issue Jan 13, 2017 · 4 comments

Comments

@robryk
Copy link
Contributor

robryk commented Jan 13, 2017

Split away form #19. We should probably open the output file for writing first and truncate it only after we have the output JPEG ready.

@khavishbhundoo
Copy link
Contributor

ignore or delete that commit....sorry i am new to github

@khavishbhundoo
Copy link
Contributor

I just started learning c++ so forgive my ignorance

Check my attempt to solve the problem
khavishbhundoo@f4c3a33

However i seems to get an issue in trying to get bazel to see my changes while compiling(sounds crazy and stupid)

I tried the following

Modified the error message (Guetzli processing failed) to something else and then ran bazel clean and bazel build -c opt //:guetzli.Surprising the error shown is still Guetzli processing failed

@Furniel
Copy link

Furniel commented Jan 15, 2017

I think we should allow optimization only with one image as argument, code will look like this:
https://github.com/Furniel/guetzli/commit/5252181fa2e1d79527b4618d7569b6e07477f0e1
With this patch image optimization works with input image or with input and optput images(output can be same).
That`s not final code, if we want allow use guetzli only with one arg we should check input image format. Everything works good if input image is jpg but if input is png - output will be written to png too now(that's not good idea).

@robryk
Copy link
Contributor Author

robryk commented Jan 16, 2017

@Furniel I don't want to encourage people to use the same file for input and output, because it generally creates confusion that leads to someone running an image through Guetzli twice (or more). Passing an image multiple times through Guetzli is not equivalent to passing it once, and will generate visible artifacts.

robryk added a commit to robryk/guetzli that referenced this issue Jan 17, 2017
robryk added a commit to robryk/guetzli that referenced this issue Jan 17, 2017
This will prevent us from failing when the output and input file are the
same file. It will also prevent us from truncating the output file if
e.g. parsing of the input file fails.

This causes us to fail late if the output file is not writable, though.

Fixes google#20.
robryk added a commit to robryk/guetzli that referenced this issue Jan 17, 2017
This will prevent us from failing when the output and input file are the
same file. It will also prevent us from truncating the output file if
e.g. parsing of the input file fails.

This causes us to fail late if the output file is not writable, though.

Fixes google#20.
robryk added a commit that referenced this issue Jan 17, 2017
This will prevent us from failing when the output and input file are the
same file. It will also prevent us from truncating the output file if
e.g. parsing of the input file fails.

This causes us to fail late if the output file is not writable, though.

Fixes #20.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants