简体   繁体   中英

How to find the last modified png file using python or django

I want to find which file is last modified.

I am modifying or updating the 'png' image on each request.

For example: piechart.png is an image; I am modifying this same image to create a new image (having same image name 'piechart.png'). I will be saving & modifying 5 images: (piechart1.png,piechart2.png,... ,piechart5.png).

How can I find which image was modified last ?

Well, this doesn't really answer your question, but it come close.

What you can do, is first download the PIL module, or the Python Imaging Library.

After that, get it installed, and then do the following:

from PIL import Image

Jpeg = Image.open("Yourfile.jpg")

print(Jpeg.info, Jpeg.format, Jpeg.mode, Jpeg.size)

This gives you some of the properties of the photo.

The same thing you can do for PNG images.

For more information about using the PIL module and getting your desired results you can go here:

http://python.developpez.com/cours/pilhandbook/php/image.php

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM