How to get width and height of a jpg file ?
Hello,
I'm trying to insert a jpg file in a blob field on my database. The problem is that I need to get the file width and height in pixels. My class does not have a graphic interface, it's a batch. Does anybody has an idea of how can I do that ?
tia.
Write a jpeg decoder that can figure out how to determine the width/height of a jpeg file? Google it.
Or if you're really lazy, load each jpeg using the
Toolkit.loadImage( URL ) function and use getWidth/getHeight from there, but that's slow.
Similar Messages
-
How to get WIDTH and HEIGHT fields from applet tag?
I am developing an applet using JDK1.1 (to ensure microsoft jvm compatability).
A problem I'm facing is that there are no getWidth() or getHeight() method for Applet in 1.1, so I am hoping I can get this info from my html: <APPLET CODE="MyApplet" WIDTH=600 HEIGHT=856></APPLET>
getParameter didn't work, so does anyone have any ideas how I could get the width and height?
Cheers,
JamesWrite a jpeg decoder that can figure out how to determine the width/height of a jpeg file? Google it.
Or if you're really lazy, load each jpeg using the
Toolkit.loadImage( URL ) function and use getWidth/getHeight from there, but that's slow. -
Get width and height of a dynamically loaded image once it's done loading?!
hello : :
well... i'm taking my first shots at flex after programming
in flash for a year now. it's been fun and i've been picking up on
things pretty well (or so i think), but i come across something
today that i used to be able to do in my as2 programming and don't
know how to do in as3...
in flex, i'm loading an image into an image control (by using
"myImgControl.load(urlString)"). i have a "complete" parameter on
the image control that calls a function just fine after the image
is loaded, but if i try and check the hight and width of the loaded
image once it loads, it comes back as zero. how can i get the
height and width of the image after it's loaded?!
in flash/as2 i used to do this little trick/work-around i
found in a forum (kirupa.com, i think) to find out the width and
height once the loaded image listener checked the loading process
and came back "complete"... in the code below, "imgLoader" is the
movieClip the image was loaded using
imgLoaderListener.loadClip(urlString, imgLoader).
quote:
iTot = imgLoader.getBytesTotal();
iLoad = imgLoader.getBytesLoaded();
if (iLoad == iTot && iTot > 4) {
imgH = imgLoader._height;
imgW = imgLoader._width;
that all make sense?!
basically, it's as simple as this: i need to find something
similar to the above for as3 that will tell me the width and height
of a dynamically loaded image after it's done loading...
so there ya have it. i appreciate any help any of you can
throw my way! thank you so much for even reading this!
: : michaelI assume you have probably already figured this out, but just
in case, there should be an event to listen for after which you can
get the height and width information successfully. I can't remember
the exact name, however. Experiment and see which one works
time-wise. -
How To Get FileType and MIME Type from a File
Hi,
I am using following ways to get FileType and MIME Type.
I am able to get file type, but I am getting MIME Type as */*
Can any one please let me know how to get MIME Type, but it should not be time consuming process.
For File Type I am using following Code:
private String getFileData(InputStream inStream) {
fileName = C:\temp\temp.tiff
String filePath = Util.createTempFile(fileName);
RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
while (inStream.available() > 0) {
byte[] buf = new byte[inStream.available()];
inStream.read(buf);
raf.write(buf);
inStream.close();
raf.close();
File file = new File(filePath);
JFileChooser chooser = new JFileChooser();
String fileType = chooser.getTypeDescription(file);
file.delete();
//MIME Type I am getting from
DataHandler data = new DataHandler(new DocumentSource(inStream));
data.getContentType();
data.getContentType() is not working well in all cases.
Can any one help me on this.
Thanks in advance,
Ram.
Edited by: javausers07 on Apr 15, 2009 4:25 PMjavausers07 wrote:
Hi,
I am using following ways to get FileType and MIME Type.
I am able to get file type, but I am getting MIME Type as */*
Can any one please let me know how to get MIME Type, but it should not be time consuming process.
For File Type I am using following Code:
private String getFileData(InputStream inStream) {
fileName = C:\temp\temp.tiff
String filePath = Util.createTempFile(fileName);
RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
while (inStream.available() > 0) {
byte[] buf = new byte[inStream.available()];
inStream.read(buf);
raf.write(buf);
inStream.close();
raf.close();
File file = new File(filePath);Why do you do all above?
JFileChooser chooser = new JFileChooser();
String fileType = chooser.getTypeDescription(file);
file.delete();
//MIME Type I am getting from
DataHandler data = new DataHandler(new DocumentSource(inStream));
data.getContentType();
data.getContentType() is not working well in all cases.That's because there's no way to get MIME type of all files on all filesystems.
Kaj -
How to get aperture3 and iPhoto to process RAW files from NEX7 ?
I have read that there is an update which fixes aperture3 and iPhoto to process RAW files from sony NEX7. How do I find and download this Update ?
Look throught http://www.apple.com/support/downloads and you'll find this
http://support.apple.com/kb/DL1510
Regards
TD -
I am almost finished a J2ME project and it is just under 32kb in Jar size. However to finish it off I wish to determine the screen size. I am aware that Canvas Class supports getWidth/Height. And as you know I can not do:
Canvas C = new Canvas(); /* It is protected!!! */
C.getHeight();
C.getWidth();
but must do this:
class Foobar extends Canvas
Foobar() {}
Foobar C = new Foobar();
C.getHeight();
C.getWidth();
However this new (and unneeded) class pushes me over my 32 kb limit. - all that class header junk etc...
There must be a better way???
Thanks all in advance...Use J2ME Polish's preprocessing power for that one:
public final static int UNDEFINED = -1;
//#ifdef polish.ScreenWidth:defined
//#= public final static int SCREEN_WIDTH = ${polish.ScreenWidth };
//#else
public final static int SCREEN_WIDTH = UNDEFINED;
//#endif
//#ifdef polish.ScreenHeight:defined
//#= public final static int SCREEN_HEIGHT = ${polish.ScreenHeight };
//#else
public final static int SCREEN_HEIGHT = UNDEFINED;
//#endifSame with CanvasHeight and CanvasWidth, if needed.
Find more info at http://www.j2mepolish.org
Best regards,
Robert -
How to get error and correct result in different file...
Hi,
sqlplus -s u/p@i >logfile /nolog <<EOF
@ sql script
exit
EOF
Is it possible to write sqplplus so as to get only connection related error in logfile and PL/SQL script related error in spool file.
Regards
SriBelow is a sample script I used recently; here "2>" puts the errors into file mentioned and I spool inside the sql script I call from sqlplus session.
Also if you use this type of connection users can not see you database users password with unix ps command -
#!/bin/ksh
export SAMPLE_USERNAME="usernm"
export SAMPLE_PASSWORD="passwd"
export SAMPLE_DATE=$1
export SAMPLE_DIR="/xxx/yyy/log"
if [[ -z $SAMPLE_DATE ]]
then
echo
echo HATA : SAMPLE_DATE parametresi girilmis olmali!..
echo
exit -1
fi
cd ${SAMPLE_DIR}
retc=0
sqlplus -s > $SAMPLE_DATE.log 2> $SAMPLE_DATE.err <<EOF
$SAMPLE_USERNAME/$SAMPLE_PASSWORD
@/xxx/scripts/yyy.sql $SAMPLE_DATE
exit ;
EOFbest regards. -
How to get width/height of a movie clip in CreateJs?
In AS3.0 it is like:
mc.width and mc.height
In AS2.0 it is like:
mc._width and mc._height
What about createJs
mc.????The answer is get "nominalBounds" and then get width and height:
var bounds = mc.nominalBounds;
bounds.width will give you width and
bounds.height will give you height
Thanks -
How to automate the changing of Width and Height of the document
Hi,
I just want to know if anyone already automate the changing of width and height of document(eps file).
Thanks,
BuddyCheck out SetDocumentSetup from kAIDocumentSuite.
-
Please let me know on how to get the width and height of an eps file.
regards,
SashiThen you can read the properties from the list of file comments… (without opening in Illustrator) an example of the line would look like this…
%%HiResBoundingBox: 19.8906 4.45117 262.1094 63.5488
So read the file and use a regular expression to find this line… It is in 'points' but so is Illustrator scripting so you need calculate other measures if required…
I have a ready made function for this but its at home… I will post later if you have no luck with this… -
Scripting TGetProperty width and height
Hello all,
i have a problem with the flash player in IE6 and FF2.
I have a html page with some flash movie elements on it.
I'm using SWFObject to bind the movies in.
After the onload event is fired, for each flash movie the
javascript function setCorrectSize4Flash will be called to resize
the html container element (embed, object tag) automatically by the
given width and height of the flash movie.
Therefore i'm checking if the movie is completely loaded and
if width and height is not undefined.
So if i'm getting width and height, i'm resizing the
container element to best fit in.
My problem is now, that the same movie used several times in
the same html page has every time different width and height
values. Sometimes the aspect ratio is 1:2 and sometimes it's 2:1.
Is this a problem of the flash player plugin or am i doing
something wrong.
Best regards,
bartmarkThank you for your answer. But I don't understand:
The question is not the margin. I put in the body margin: 0; padding:0; and there is no margin.
I want to know the viewport: the width and height with the iPad in horizontal position and without the address bar.
This does not coincide with the 1024 x 768. (nor the 946 x 768 if I rest the address bar). I don't understand why
Thank you
Narcís -
Fix width and height of accordion
Hi All
I am building an application using jquery accordion on region 3 of page 0. In each subregion I have a treeview and when a node is choosen shows details about this node. My issue is how to fix width and height of accordion. I tried with jquery tabs instead of accordion and I put this on region header 'style=\"overflow-x:auto;display:block;max-width:340px;min-width:340px;overflow-y:auto;max-height:450px;min-height:450px;";" ', and closing tag at region footer and it worked.
Any idea?
Thanks a lot.
Ricardo
Theme: 13
EPG
Version: 4.0.2.00.06Hi Jitu
Thank you for your replay but it didn't work as I need.
I made the following test. I put on region attribute \style="width:350px;". When each subregion of accordion has only a treeview, it didn't work. When I created another subregion into accordion with a simple report, it worked fine.
I don't know what is going on and also how to fix it.
Any other idea?
Ricardo -
How can I get the image width and height stored in database?
Hi!I write s servlet to display images store in database.but how can I get the image width and height?
Have you tryed using PJA or a similar library?
I presume you get java.lang.NoClassDefFoundError on the line :
Toolkit.getDefaultToolkit();? -
How do i get the max width and height?
Hey
I want to get the max width and height, so my desktoppanes size can be set automatically.
I know i should use getBounds but i cant find a concrete example on goole, on how to use it.
Can someone point me in the right direction, with an example?Ok, assuming you want to get the screen resolution, i.e. 1024 x 768.
You will need these imports:
import java.awt.Dimension;
import java.awt.Toolkit;and this line of code:
Dimension myScreen = Toolkit.getDefaultToolkit().getScreenSize() ;You can now use myScreen.width and myScreen.height to access the height and width of your screen's resolution. (width = 1024, height = 768 in my case)
Hope this helps,
Stern
Edited by: Stern on Apr 13, 2008 6:49 AM -
How to get the width and height of the selected rectangle
Hi,
I need to get the width and height of the selected rectangle in indesign cs3 and display the values in a dialog box for user verification.
Regards,
saranHi Saran,
InterfacePtr<IGeometry> itemGeo ( objectUIDRef, UseDefaultIID() );
PMRect ItemCoord = itemGeo->GetStrokeBoundingBox();
PMReal width = ItemCoord->Width();
PMReal height = ItemCoord->Height();
Maybe you are looking for
-
recently bought a blackberry 8520 its imei is in italy 3584720********* and the pin is 215***** company: TIM color: Blue Frost the problem is that I brought to the Dominican Republic and I've been using here in this country and after I broke the s
-
[ANN] Oracle JDeveloper 10g is now available for download.
It's probably worth a mention in this forum too ;-) In case you haven't notice we have just released Oracle JDeveloper 10g production with a many new features that makes it the ideal Java tools for Oracle Application Server users. Check it out at: ht
-
Error with patching Oracle DB 11.1.0.6 (Patch 10 - 7378392)
Hi, I am getting an error when trying to appy the patch 7378392 on Oracle DB 11g. I am using the command opatch appy It worked great with other patches. What am I doing wrong? Best regards, Dejan Invoking OPatch 11.1.0.6.0 Oracle Interim Patch Instal
-
Sending Java object using E-Mail
Dear Experts, In my application I am trying write java Object in a file. Then I have to attach that file with an E-Mail. In the receiver side I have to download the file and read the Java Object from file. The Problem is , when I am sending and recei
-
Maverick 10.9 - Maps Application not showing map images
Just installed Maverick and the Maps application does not show the map images (Standard, Hybrid, or Satellite) - see below. Otherwise everything seems to be working in the sense if you create a drop pin it will show the address, etc. Any ideas?