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

referenced memory is not changed. #503

Closed
sunwoo76 opened this issue Sep 13, 2024 · 3 comments
Closed

referenced memory is not changed. #503

sunwoo76 opened this issue Sep 13, 2024 · 3 comments

Comments

@sunwoo76
Copy link

    image = pyvips.Image.new_from_file(svg_path)
    image.write_to_file(os.path.join(png_path)) # first-saving

   ~~ some code for changing the content in svg file from "svg_path" ~~

    image = pyvips.Image.new_from_file(svg_path)
    image.write_to_file(os.path.join(png_path)) # second-saving

In this case, the svg contents are changed in the middle of the code.
After changing the content and re-write to the same svg_path and read again with the same svg_path.

However, the first-saving result and second-saving result are the same.

How can I treat this?

Thank you.

@jcupitt
Copy link
Member

jcupitt commented Sep 13, 2024

Hello @sunwoo76,

libvips caches many operations to improve speed. You can force a loader to go back to the source and reload the image with:

image = pyvips.Image.new_from_file(svg_path, revalidate=True)

@sunwoo76
Copy link
Author

sunwoo76 commented Sep 23, 2024

Hello @sunwoo76,

libvips caches many operations to improve speed. You can force a loader to go back to the source and reload the image with:

image = pyvips.Image.new_from_file(svg_path, revalidate=True)

Thank you for replying :)

However, the new error has occured:

  File "./get_render_310.py", line 380, in <module>
    image = pyvips.Image.new_from_file(svg_path, revalidate=True)
  File "/home/psc/anaconda3/lib/python3.8/site-packages/pyvips/vimage.py", line 352, in new_from_file
    return pyvips.Operation.call(name, filename,
  File "/home/psc/anaconda3/lib/python3.8/site-packages/pyvips/voperation.py", line 290, in call
    raise Error('{0} does not support optional argument {1}'
pyvips.error.Error: VipsForeignLoadMagickFile does not support optional argument revalidate

I checked the supported argumnet of "VipsForeignLoadMagickFile". The results as below:
input: ['all_frames', 'density', 'disc', 'access', 'sequential']
output: ['flags']

It seems that the optional argument is not supported.

ps.
My current pyvips version is 2.2.3.

@jcupitt
Copy link
Member

jcupitt commented Sep 23, 2024

revalidate was added in libvips 8.15, perhaps you are using an older version?

@sunwoo76 sunwoo76 closed this as completed Oct 4, 2024
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

2 participants