L
Lad
Hello ,
is it possible to add( with PYTHON language) several image files into
one?
Thanks for reply
L.
is it possible to add( with PYTHON language) several image files into
one?
Thanks for reply
L.
Lad said:Hello ,
is it possible to add( with PYTHON language) several image files into
one?
Thank you for your reply.K.S.Sreeram said:Google for 'Python Imaging Library'...
Regards
Sreeram
I was thinking about this: to open each image file in binary
mode , read it and write into the result image file? Is that
possible?
Of course, but what you haven't said yet is how you want the resultingLad said:Thank you for your reply.
I was thinking about this:
to open each image file in binary mode , read it and write into the
result image file?
Is that possible?
Regards,
L
SteveSteve said:Of course, but what you haven't said yet is how you want the resulting
image file to behave. Do you want it to contain tiled copies of the
original images, or be an animation with each frame being one of the
original images, or something else I haven't thought of.
We aren't mind readers here.
though-some-regulars-get-close-ly y'rs - steve
--
Zip file? Image file? "Add all these pictures into one file" isn't (froLad said:Steve
Thank you for your reply
All that I want is this:
I download ( via Python) some pictures from internet and I want to add
all these pictures into one =one file/
So far, I managed to download pictures but I do not know how to add i
them nto one file.
How can I do that?
Thank you for reply and help
L.
Zip file? Image file? "Add all these pictures into one file" isn't (fro
me) a sufficient specification.
Lad said:I want to to do that as easy as possible.
I think the easest way could be add( append) an image to another
into an image file so that I can use an image browser and see all
pictures in one file. Is that possible?
But not even more easy.
Well, you can do it with PIL, creating a very big white image and
putting on it all the images, as tiles.
But probably you want to do something different.
Maybe you can use PyUNO to create a PowerPoint-like (Presentation) file
with an image on each page.
If you are on Win another easy way is to create an Html page that shows
all the pics, open it with Explorer and save it as a single HMT file.
Probably there are other solutions.
Lad said:Open a picture file( download it from internet) and write it in a
result file( being open in binary mode).
Then download another file and append to the result file.
And so on...
But is it possible? Will be the pictures in the result file seen
well??
Fredrik,Fredrik said:the internal structure of an image file is quite a bit more complicated
than the internal structure of a text file, so it's not very likely that
you would get very far with that approach.
why not just put all the files in a directory, and use an image viewer
with collage or slideshow support ?
Lad said:I really would like to have ALL pictures in one file.
So, what would be the easiest/best way how to do that?
Lad said:I really would like to have ALL pictures in one file.
merge_images( ['1.jpg','2.jpg','3.jpg'], 'output.jpg' )
As a collage onlyFredrik said:do you want to look at the images as a slideshow or as a collage?
</F>
Sreeram,K.S.Sreeram said:Lad said:I really would like to have ALL pictures in one file.
import Image
def merge_images( input_files, output_file ) :
img_list = [Image.open(f) for f in input_files]
out_width = max( [img.size[0] for img in img_list] )
out_height = sum( [img.size[1] for img in img_list] )
out = Image.new( 'RGB', (out_width,out_height) )
y = 0
for img in img_list :
w,h = img.size
out.paste( img, (0,y,w,y+h) )
y += h
out.save( output_file )
Use like this:merge_images( ['1.jpg','2.jpg','3.jpg'], 'output.jpg' )
Regards
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.