Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Compress Image Utility Added
  • Loading branch information
Dhrumil-Zion committed Jun 11, 2021
commit 9814a20334538eca1fbf10298148c022f9dac549
Binary file added Compress Image/1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Compress Image/1_compressed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added Compress Image/README.md
Empty file.
15 changes: 5 additions & 10 deletions Compress Image/code.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import PIL
from PIL import Image

print("enter image name :")
image_name = str(input()) # image name with relative path

img = Image.open(image_name)
mywidth = img.size[0]
myheight = img.size[1]
img = img.resize((mywidth, myheight), PIL.Image.ANTIALIAS)
img.save("Resized_Image.jpeg")
img = Image.open('1.jpg') ## file name of relative path with file name (with extension)
h,w = img.size ## getting height and width of image
img = img.resize((h,w),Image.ANTIALIAS) ## compression
img.save('1_compressed.jpg') ## output location and file name
print("Image Compression Process Successfully Completed !! ")
Binary file removed Compress Image/demo.jpg
Binary file not shown.