Solved

Image dpi

Posted on 2007-12-06
15
1,384 Views
Last Modified: 2013-12-25
Does anybody know how to detect an image dpi with the new ColdFusion 8 tags, or any other way in ColdFusion.
0
Comment
Question by:TIO-Solutions
  • 8
  • 5
  • 2
15 Comments
 
LVL 16

Expert Comment

by:BongSoo
ID: 20420447
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20420575
AFAIK cfimage does not do DPI

the only thing I've come across cfx_imageInfo is http://www.cfmcentral.com/gallery/detail.cfm?Script_ID=52 (open source)

from the docs

"FILE Parameters

    IN

    FILE
        Name of the image file you wish to have information about.

    OUT

        * ImageInfo ("OK" or blank)
        * ImageInfoError
        * ImageInfoFile
        * ImageInfoType
        * ImageInfoWidth
        * ImageInfoHeight
        * ImageInfoPixels
        * ImageInfoSize
        * ImageInfoPixelBits
        * ImageInfoCompression
        * ImageInfoColors
        * ImageInfoColorType
        * ImageInfoDPI <----------------------------
        * ImageInfoComments "
0
 
LVL 16

Expert Comment

by:BongSoo
ID: 20421006
Good point. Can you use the 'absolute size' since it gives you the height & width in pixels?
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20421367
"Can you use the 'absolute size' since it gives you the height & width in pixels?"

pixel width/height and real world width/height have no relation since a 100px x 100px image at 72dpi can be  the same size as a 100px x 100 px image at 300 dpi

the confusion arises from the improper use of DPI which is a real world thing (ie: number of dots a printer can make on paper or the halftone screen on film) and PPI (pixels per inch) which is it's resolution...

more info here  http://www.kcbx.net/~mhd/2photo/digital/pixel.htm
0
 
LVL 16

Expert Comment

by:BongSoo
ID: 20421532
Oh, I am plenty familiar with real world use, I just don't know what TIO-Solutions has in mind, and in what context his images are being used.

But I am not sure you are 100% correct when you say that:

<<since a 100px x 100px image at 72dpi can be  the same size as a 100px x 100 px image at 300 dpi>>

In this instance, it depends upon how you define size: viewing size or total file size. If you are implying the total file size is the same, I would agree. If you are implying the viewing size is the same, I would say that depends largely upon what the image is being viewed in and would actually NOT be the same in most cases.

If its typical web stuff, you might be able to make the assumption that the files are 72 ppi, but I think we need more info from TIO. I was assuming he was (incorrectly as you pointed out) using DPI and PPI interchangeable, as most people do these days. Its pretty much become standard vernacular.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20422166
in what situation would they not be the same size? afaik 100px is 100px

I created 2 jpgs in corelpaint

one at 100px x 100px image at 72dpi and one at 100px x 100 px image at 300 dpi

when printed, they are the same size 0.3333 in. (100x100) however small text is unreadable at 72dpi (meaning that it is in fact dpi and not ppi)

when viewed in a browser, win pic/fax viewer and corel, they are the same size but are affected by the PPI - and are about 1.0625 in (measured on screen) on my 1280x1024 19in monitor. Changing the monitor rez to 800x600 changes the display size of both to 1.625 in

fwiw, I actually asked myself the same thing, could you figure dpi out based on pixels vs file size, but it doesn't seem possible

my 2 files have the following properties

fileA - 72 dpi 100px x 100px 825 bytes
fileB - 300 dpi 100px x 100px 827 bytes

i can't see any way to make any use of that...









0
 
LVL 16

Expert Comment

by:BongSoo
ID: 20422273
Try placing them in an html document and viewing them. The size will be different.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 36

Expert Comment

by:SidFishes
ID: 20422438
nope....

 size is the same (in both FF and IE)

afaik browsers (rightly) ignore dpi. I think they always display at 72 or 96 dpi depending on mac or pc). PPI is all they care about so my 100x100 images are exactly the same even though the dpi is very different.
0
 
LVL 16

Expert Comment

by:BongSoo
ID: 20422493
you know what? I am thinking of something else. You're right.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20422530
"I think they always display at 72 or 96 dpi depending on mac or pc"

that's wrong i find.. (even the first source I checked got it wrong... hehe)

it really is PPI

this is as clear an explanation as i've found

"On a web page, only PPI is relevant, and there are 72 PPI on a Mac or a PC screen at "normal" screen resolutions. It doesn't matter what resolution you do your scans or the resolution of your PhotoShop files, a 120 pixel wide graphic will be 120 pixels wide at 72 DPI or at 600 DPI. If you print those files on a laser or ink-jet printer from within your graphics package, then it will be a different story, the 72 DPI will be large and pixelated and the 600 DPI file will be small and crisp. If you print the files from within a web page, what you get is effectively 72 DPI. Period."


http://www.wpdfd.com/issues/5/its_the_difference_that_makes_the_difference/



0
 

Author Comment

by:TIO-Solutions
ID: 20425743
Hi

Thank you for everybody's responses.

We are a tourist company and we are sourcing images for download to our brands for the purpose of web use and actual brochure use, so they need to see what the resolution is of the image before they download it for use.

ID:20420575 is pretty much what I need, I have however tried to use it before I posted this question but I am getting the following error:

Error occurred in tag CFX_IMAGEINFO  
Unexpected error occurred while processing tag.  
 
The error occurred in C:\Inetpub\wwwroot\TIOConnect\test.cfm: line 1
 
1 : <CFX_ImageInfo file="C:\Inetpub\wwwroot\tioconnect\thumb_minitrain.jpg">
2 : <CFOUTPUT>
3 : <pre>
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20428201
I got it to work... sort of...

the supplied examples partially work and produce the info below (including dpi)

I'm wondering if you registered the customtag?

cfadmin -> cfx tags -> Register C++ CFX -> name tag cfx_imageinfo -> choose path to dll


    File 	Error 	Type 	Width 	Height 	Pixels 	Size 	PixelBits 	Colors 	ColorType 	Compression 	DPI 	Comments

    c:\inetpub\wwwroot\test\html\16.bmp 		bmp 	443 	333 	147519 	12262 	4 	16 	CLUT16 	RLE 	72 	

    c:\inetpub\wwwroot\test\html\16.pcx 		pcx 	544 	384 	208896 	20708 	4 	16 	CLUT 	PCX Run-length encoding. ZSoft. Version 2.8 w/ palette information. 	72 	

    c:\inetpub\wwwroot\test\html\2.pcx 		pcx 	544 	384 	208896 	5157 	1 	2 	CLUT 	PCX Run-length encoding. ZSoft. Version 2.5 of PC Paintbrush. 	72 	

    c:\inetpub\wwwroot\test\html\24.pcx 		pcx 	544 	384 	208896 	107603 	24 	16777216 	RGB 	PCX Run-length encoding. ZSoft. Version 3.0+ PC Paintbrush. 	72 	

    c:\inetpub\wwwroot\test\html\cfximageinfo.png 		png 	542 	126 	68292 	30847 	24 	16777216 	RGB 	Method 0 (32k sliding window deflate/inflate compression) 	0 	Creation Time

    c:\inetpub\wwwroot\test\html\cmyk.jpg 		jpg 	443 	333 	147519 	29181 	32 	4294967296 		Baseline 	0 	File written by Adobe Photoshop¨ 5.

    c:\inetpub\wwwroot\test\html\cmyk.tif 		tif 	837 	365 	305505 	37924 	32 	4294967296 	CMYK 	LZW (Lempel-Ziv-Welch, Unisys US Patent No 4,558,302) 	72 	IMAGEDESCRIPTION: This is the caption. ARTIST: L.A.Sellers COPYRIGHT: Yo! It's mine!

    c:\inetpub\wwwroot\test\html\fax.tif 		tif 	512 	384 	196608 	3436 	1 	2 	WhiteIsZero 	T4-encoding: CCIT T.4 bi-level encoding 	72 	

    c:\inetpub\wwwroot\test\html\grayscale.jpg 		jpg 	585 	260 	152100 	6309 	8 	256 	Grayscale 	Baseline 	0 	

    c:\inetpub\wwwroot\test\html\packbits.tif 		tif 	512 	384 	196608 	27756 	24 	16777216 	RGB 	Packbits compression 	72 	IMAGEDESCRIPTION: packbits

    c:\inetpub\wwwroot\test\html\test.bmp 		bmp 	443 	333 	147519 	443610 	24 	16777216 	RGB 	None 	72 	

    c:\inetpub\wwwroot\test\html\test.gif 		gif 	500 	200 	100000 	6079 	7 	256 	CLUT 	LZW (Lempel-Ziv-Welch, Unisys US Patent No 4,558,302) 	0 	

    c:\inetpub\wwwroot\test\html\test.jpg 		jpg 	640 	480 	307200 	9092 	24 	16777216 	RGB 	Baseline 	0 	

    c:\inetpub\wwwroot\test\html\test.pcx 		pcx 	544 	384 	208896 	30620 	8 	256 	CLUT 	PCX Run-length encoding. ZSoft. Version 3.0+ PC Paintbrush. 	72 	

    c:\inetpub\wwwroot\test\html\test.png 		png 	1024 	768 	786432 	32054 	24 	16777216 	RGB 	Method 0 (32k sliding window deflate/inflate compression) 	0 	

    c:\inetpub\wwwroot\test\html\test.psd 		psd 	1600 	900 	1440000 	324935 	32 	4294967296 	CMYK 	RLE 	0 	

    c:\inetpub\wwwroot\test\html\test.tga 		tga 	534 	384 	205056 	40279 	24 	16777216 	RGB 	RLE RGB 	0 	

    c:\inetpub\wwwroot\test\html\test.tif 		tif 	1116 	486 	542376 	44846 	24 	16777216 	RGB 	LZW (Lempel-Ziv-Welch, Unisys US Patent No 4,558,302) 	72 	IMAGEDESCRIPTION: This is the caption. ARTIST: L.A.Sellers COPYRIGHT: Yo! It's mine!
 

18 records

Open in new window

0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20428414
on further testing it appears that the file parameter isn't working??

 folder parameter works (which is what the above is)

however another thing... it appears it can't read dpi on jpg's ...bmps work but shows 0 for jpgs

the version I'm testing has last notes in 1999 so perhpoas it's too old to work correctly... I'll see if i can find a lter version...
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 20428646
ok... the version i had was old

the latest one i found is from

http://www.intrafoundation.com/cfx_imageinfo.asp

and it seems to work properly no errors and I do get the dpi for jpgs...


Status

query

  	COLORS 	COLORTYPE 	COMMENTS 	COMPRESSION 	CREATED 	DPI 	DURATION 	ERROR 	FILE 	FORMAT 	HEIGHT 	LASTACCESS 	LASTMOD 	LAYERS 	PATH 	PIXELBITS 	PIXELS 	SIZE 	TRANSPARENCY 	TRANSPARENCYINDEX 	TYPE 	WIDTH

1 	16777216 	RGB 	[empty string] 	Baseline 	{ts '2007-12-06 10:20:07'} 	72 	0 	[empty string] 	new2.jpg 	JFIF 	100 	{ts '2007-12-07 08:50:31'} 	{ts '2007-12-06 10:20:09'} 	0 	c:\inetpub\wwwroot\test\new2.jpg 	24 	10000 	825 	[empty string] 	[empty string] 	jpg 	100

Open in new window

0
 

Accepted Solution

by:
TIO-Solutions earned 0 total points
ID: 20571119
Thank you to all, I have solved the problem.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now