PIL reducing image size just by opening and savingpython PIL save image different size originalHow do I resize an image using PIL and maintain its aspect ratio?Twitter image encoding challengeSave plot to image file instead of displaying it using MatplotlibChanging image size in MarkdownPIL - Pasting/saving image as .jpgPIL Image resize compresses the image when is not expected topython PIL save image different size originalReduce image size in C#Why does the size of the jpg file reduce when we open and save an image using PIL in python?Trying to open image with PIL
Talk interpreter
Why is getting a PhD considered "financially irresponsible" by some people?
How to say "I only speak one which is English." in French?
Why does this London Underground poster from 1924 have a Star of David atop a Christmas tree?
Term used to describe a person who predicts future outcomes
Videos of surgery
Can a DM change an item given by another DM?
Defending Castle from Zombies
How to pass 2>/dev/null as a variable?
Find feasible point in polynomial time in linear programming
What are the IPSE’s, the ASPE’s, the FRIPSE’s and the GRIPSE’s?
What to do about my 1-month-old boy peeing through diapers?
Is there a word or phrase that means "use other people's wifi or Internet service without consent"?
Are (c#) dictionaries an Anti Pattern?
Why does the `ls` command sort files like this?
How do we improve collaboration with problematic tester team?
What is the name of this plot that has rows with two connected dots?
Dual of a bimodule
Are there any to-scale diagrams of the TRAPPIST-1 system?
What is Soda Fountain Etiquette?
Is the Amazon rainforest the "world's lungs"?
Using a JoeBlow Sport pump on a presta valve
Fill NaN based on previous value of row
Is it unusual for a math department not to have a mail/web server?
PIL reducing image size just by opening and saving
python PIL save image different size originalHow do I resize an image using PIL and maintain its aspect ratio?Twitter image encoding challengeSave plot to image file instead of displaying it using MatplotlibChanging image size in MarkdownPIL - Pasting/saving image as .jpgPIL Image resize compresses the image when is not expected topython PIL save image different size originalReduce image size in C#Why does the size of the jpg file reduce when we open and save an image using PIL in python?Trying to open image with PIL
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")
When I checked the sizes of the files, they were like this:
nature.jpg -> 1.3 MB (13,28,902 bytes)
new_nature.jpg -> 636.4 kB (6,36,354 bytes)
Their image type and resolution both were same.
This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg
Can anyone tell me why is this happening ?
python image compression python-imaging-library
add a comment |
I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")
When I checked the sizes of the files, they were like this:
nature.jpg -> 1.3 MB (13,28,902 bytes)
new_nature.jpg -> 636.4 kB (6,36,354 bytes)
Their image type and resolution both were same.
This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg
Can anyone tell me why is this happening ?
python image compression python-imaging-library
1
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37
add a comment |
I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")
When I checked the sizes of the files, they were like this:
nature.jpg -> 1.3 MB (13,28,902 bytes)
new_nature.jpg -> 636.4 kB (6,36,354 bytes)
Their image type and resolution both were same.
This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg
Can anyone tell me why is this happening ?
python image compression python-imaging-library
I have these lines of code which open an image nature.jpg using PIL and again save it by the name new_nature.jpg
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg")
When I checked the sizes of the files, they were like this:
nature.jpg -> 1.3 MB (13,28,902 bytes)
new_nature.jpg -> 636.4 kB (6,36,354 bytes)
Their image type and resolution both were same.
This is the link for the image: http://www.youandthemat.com/wp-content/uploads/nature-2-26-17.jpg
Can anyone tell me why is this happening ?
python image compression python-imaging-library
python image compression python-imaging-library
asked Mar 27 at 20:24
trahultrahul
12 bronze badges
12 bronze badges
1
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37
add a comment |
1
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37
1
1
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37
add a comment |
1 Answer
1
active
oldest
votes
JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)
Read docomentishion here.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385851%2fpil-reducing-image-size-just-by-opening-and-saving%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)
Read docomentishion here.
add a comment |
JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)
Read docomentishion here.
add a comment |
JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)
Read docomentishion here.
JPEG images can be compressed and saved in different qualities.
The quality can be any number between 1 (worst) and 95 (best). the default saving quality is 75, and to get a better quality image you should try something like this:
from PIL import Image
im = Image.open("nature.jpg")
im.save("new_nature.jpg", quality=95)
Read docomentishion here.
answered Mar 27 at 22:51
RealA10NRealA10N
741 silver badge9 bronze badges
741 silver badge9 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385851%2fpil-reducing-image-size-just-by-opening-and-saving%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Possible duplicate of python PIL save image different size original
– MFisherKDX
Mar 27 at 20:26
Since JPEG is lossy, it's quite likely that even if you got all the parameters identical, the re-compressed image will be different (both in size and in content). If the quality settings (in your code left to default value) differ from the original (as seems to be in this case), that size difference will be significant.
– Dan Mašek
Mar 27 at 21:37