Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image format in python
#1
i was looking through some old C functions (i am planning to write them in python) and one of them stood out as needing some more python knowledge Doh this function takes a 2D array pixels in RGB and produces a 16777216 color GIF file Shifty   i may have to implement this for python as a C function Evil  but what i really need to know is how python programmers store their images in memory while working with them  Drool   can someone tell me or point me to documentation? Pray

oh, and, yes GIF really can do 24-bit color Dance   but many program can't handle them. Sad
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
(Nov-05-2016, 08:49 AM)Skaperen Wrote:  but what i really need to know is how python programmers store their images in memory while working with them

Well if you are doing stuff that borders on computer vision then generally we use numpy arrays.  The OpenCV library is the way to go if doing anything complicated (note the format is BGR annoyingly).

Really depends what you are doing.  Pillow might be enough or even Pygame, but if you are doing heavy image manipulation, numpy (and numpy back libraries) are the way to go.
Reply
#3
(Nov-05-2016, 09:12 AM)Mekire Wrote:
(Nov-05-2016, 08:49 AM)Skaperen Wrote:  but what i really need to know is how python programmers store their images in memory while working with them

Well if you are doing stuff that borders on computer vision then generally we use numpy arrays.  The OpenCV library is the way to go if doing anything complicated (note the format is BGR annoyingly).

Really depends what you are doing.  Pillow might be enough or even Pygame, but if you are doing heavy image manipulation, numpy (and numpy back libraries) are the way to go.

I will mention Pillow. It's a 3th party library which is designed for an image processing.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#4
so basically, if you had a task to insert some pixels in an image file, you might implement it as loading/converting that file to pixels using pillow, modify the pixels, then dump/covert it back to a file of the same format using pillow?

suppose you had 2 image processing programs (in python) running at the same time an one needs to transfer an image to the other over an existing TCP connection (these programs might be running on separate computers). what format might you send the image in? (suppose security is good enough to trust pickle). can a pillow Image object be pickled?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
TCP can transfer binary data, right? I don't know for Pillow but native Python can handle this. If not, there are twisted, requests, pyzmq. For example.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#6
Data Encryption?
Reply
#7
For sure! PyNaCl
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#8
asking if the goal is image embedded encryption
Reply
#9
If the image goes to the network or some data, no matter where it goes, it has to be encrypted.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#10
asking skaperen 'if the goal is image embedded encryption '
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Upload image to Instagram using python/selenium using image URL failed, need help greenpine 5 5,491 Feb-22-2022, 09:42 PM
Last Post: snippsat
  PIL Image / python-resize-image AttributeError sallyjc81 1 5,018 Aug-02-2020, 12:06 AM
Last Post: scidam
  write image into string format into text file venkat18 2 4,418 Jun-01-2019, 06:46 AM
Last Post: venkat18
  Windows DIB format in bytearray to image? dusca 2 2,772 Mar-28-2018, 10:35 PM
Last Post: dusca

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020