Hi there,
In Photoshop I can, when I want to change the dpi(dots per inch) of a
picture, arrange that the picture won't be resized. Do you know of a way, I
can accomplish this in python with PIL? If I use this script it changes the
dpi, but the picture becomes huge.
Thanks
Arjen
import sys
import Image
import os
a=sys.argv[1]
print a
c="or"+a
b=os.system("re name %s %s" % (a, c))
im=Image.open(c )
print im.info["dpi"]
im.save(a, dpi=(150, 150) 2 8401
duikboot wrote: Hi there,
In Photoshop I can, when I want to change the dpi(dots per inch) of a picture, arrange that the picture won't be resized. Do you know of a way, I can accomplish this in python with PIL? If I use this script it changes the dpi, but the picture becomes huge.
Thanks
I might be completely wrong, but I think you have an error here.
Basically, a monitor has a set resolution (the resoultion at which you
run your graphics card). That resolution has a certain number of dots
per inch. So, if you increase the dots per inch of an image, you are
making it bigger and will require more monitor space or page area to
show or print it. What you are doing with Photoshop, most probably, is
increase the Dots Per Inch (DPI) AND rescaling it only for viewing
purposes on your screen. So although you see it the same size, the
picture surely is bigger. If that's the case, your script is doing what
it's supposed to do, but you need to "fit to screen" or something like
that if you want it to remain the same size ONLY for viewing purposes.
Gedece
"duikboot" <a@spam.nl> wrote: In Photoshop I can, when I want to change the dpi(dots per inch) of a picture, arrange that the picture won't be resized. Do you know of a way, I can accomplish this in python with PIL? If I use this script it changes the dpi, but the picture becomes huge.
Thanks
Arjen
import sys import Image import os a=sys.argv[1] print a c="or"+a b=os.system("re name %s %s" % (a, c))
That's usually spelled os.rename(a, c)
im=Image.open(c ) print im.info["dpi"] im.save(a, dpi=(150, 150))
I think you're confusing image size with file size.
"Image.open " loads the image into a PIL Image object, and "save"
creates a new file from the contents of that object. The image size
(in pixels) doesn't change when you do this.
However, the file size may change. For some file formats, PIL can
read compressed files but not write files using the same compression
(usually for legal reasons). GIF is one such example. TIFF LZW is
another one.
If you can, use PNG instead.
</F> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: TheKeith |
last post by:
I don't know much about javascript, so take it easy on me. Is there a way to
dynamically change a CSS layers dimensions on the fly. Here is what I'm
doing. I have a bunch of thumbnails that when clicked on, will open up the
full view in a CSS layer, as opposed to a pop-up window let's say. I had
this before, but with one layer for each image, and as you might imagine,
the markup was way too bloated. So can I just change the css layers...
|
by: jeff |
last post by:
Hello,
I have a form that submits it's values to a pop-up window. I've
simplied the code:
<form name="formname" action="action.php" target="windowName"
method="post" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=yes,resizable=no,width=300,height=200,left=362,top=284');">
|
by: D. Alvarado |
last post by:
Hello,
I am trying to open a window containing an image and I would like
the image to be flush against the window -- i.e. have no padding or
border. Can I make this happen with a single call to a window.open
function? I would prefer not to create a separate HTML page. So far
all I have is the basic
var cwin = window.open('images/KJV-THANKS.gif',
'Thanks', 'width=243,height=420,');
cwin.focus();
|
by: John Ortt |
last post by:
Hi there everyone,
I have a part info form which has a faded image of our company logo as a
background.
I want to replace the faded image with a bright red warning image on items
which have run out of purchasing cover.
I am nearly there, the only problem is that the code below only changes the
image background for text and combo-box backgrounds, it doesn't apply it to
the whole form.
|
by: lauren quantrell |
last post by:
Is there a way to force a change in a user's screen resolution using
VBA code without having any input from the user?
Example: User John Backwards has his screen set to 800 x 600 pixels.
Backwards loads an Access app that needs at least 1024 x 768 pixels so
the app, on load, changes the screen resolution for him to 1024 x 768.
| |
by: Unknown |
last post by:
Does anyone know how I would change the Hue of a bitmap I have? I tried
looking for a class that would help me, but all I can find is methods that
retrieve Hue values and not change them..
|
by: spielmann |
last post by:
Hello
I want to change the scrollbar size of windows, How can I do that with
vb.net
I have find this in VB6 but how can we convert simply this code.
thx
|
by: Marcel Brekelmans |
last post by:
Hello,
I save and restore the position and dimensions of a form using
'this.DeskTopBounds'. However, every time I open the form its Height grows
with 19 or so pixels! Is there something I should subtract from the
DeskTopBounds Rectangle's Height value?
Thanks,
Marcel
|
by: Stan Brown |
last post by:
For some time now, I've been wanting to improve the look of the menus
at my site http://www.tc3.edu/instruct/sbrown/stat/ . I like way
these two work, opening a submenu when hovering on a selection:
http://www.cssplay.co.uk/menus/simple_vertical.html
http://www.grc.com/menu2/invitro.htm
They are pure CSS with no JS (even for MSIE 5 and 6). And they
degrade acceptably in a non-CSS browser like Lynx. But both are set
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |