473,372 Members | 1,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

python image digitizing

i am a newbie to python..and trying to use it to get data in a jpeg image

i can do this in java like
Expand|Select|Wrap|Line Numbers
  1.     FileInputStream fIn = new FileInputStream(filename);
  2.    JPEGImageDecoder jpeg_decode= JPEGCodec.createJPEGDecoder(fIn);
  3. BufferedImage image = jpeg_decode.decodeAsBufferedImage();
  5.             width = image.getWidth();
  6.             height = image.getHeight();
  8.             int[] rgbdata = new int[width * height];
  10.             image.getRGB(0,0,width,height,rgbdata,0,width);
  13.             bytes = new byte[rgbdata.length];
  14.             doubles = new double[rgbdata.length];
  15.             int i;
  16.             for ( i = 0; i < bytes.length; i++) {
  17.               bytes[i]    = (byte)  (rgbdata[i] & 0xFF);
  18.               doubles[i]  = (double)(rgbdata[i]);
  19.             }
  21.             fIn.close();
  22.         }
but how do i do that in python?i wish to get the image data as byte[] and double[]

can anyone suggest a way
Oct 7 '07 #1
2 2691
126 100+
I have no idea what the [EDIT: expalative delete] you are talking about.

But i guess that PIL (Python Imaging Library) is a good place to start.
Oct 7 '07 #2
well, i was trying to get the rgb pixels as a from a jpeg image ,i can do this in java using the above code..but i am new to python &PIL ,so i was wondering if anybody knows how to do that ..it seems like a common enuf task

Oct 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Jason | last post by:
Hey, I'm an experience programmer but new to Python. I'm doing a simple implementation of a field morphing techinique due to Beier and Neely (1992) and I have the simple case working in Python...
by: fdsl ysnh | last post by:
--- python-list-request@python.orgд: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit >...
by: Xah Lee | last post by:
One-Liner Loop in Functional Style Xah Lee, 200510 Today we show a example of a loop done as a one-liner of Functional Programing style. Suppose you have a list of file full paths of...
by: Gabe Johnson | last post by:
Hello Python people, Does anybody have experience using Python and digitizing tablets such as a Wacom Tablet? I would like to know if Python is capable of giving you the high-resolution data...
by: corey.coughlin | last post by:
Alright, so I've been following some of the arguments about enhancing parallelism in python, and I've kind of been struck by how hard things still are. It seems like what we really need is a more...
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 430 open ( -4) / 3447 closed (+17) / 3877 total (+13) Bugs : 922 open ( -7) / 6316 closed (+31) / 7238 total (+24) RFE : 245 open...
by: Ohmster | last post by:
I am trying to use this cool script that some MIT guy wrote and it just does not work, I get a stream of errors when I try to run it. It is supposed to visit a URL and snag all of the pictures on...
by: Independent | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
by: james.duckworthy | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.