How to find out resolution of an image?
Hi, all
Most common image formats (DIB, JPEG, PNG, TIFF and perhaps others) store the resolution of the image in pixels per inch (or other, similar units). I haven't found a way to find out this information using the Java libraries. Neither the AWT image classes nor the snazzy JAI classes seem to read & store this information, let alone make it public.
Is there a way to determine the resolution, short of poking through the header of the image data myself?
Thanks
- rick
Here's the solution (hopefully no one else ever has to track it down - the documentation is very well hidden by Sun).
ImageInputStream imageInput = ImageIO.createImageInputStream( fil );
Iterator it = ImageIO.getImageReaders(imageInput);
ImageReader reader = null;
while (it.hasNext()) {
reader = (ImageReader) it.next();
System.out.println(reader.toString());
reader.setInput(imageInput);
ImageReadParam param = reader.getDefaultReadParam();
BufferedImage bimg = reader.read(0, param);
IIOMetadata meta = reader.getImageMetadata(0);
org.w3c.dom.Node n = meta.getAsTree( "javax_imageio_1.0" );
n = n.getFirstChild();
while (n != null){
if( n.getNodeName().equals( "Dimension")){
org.w3c.dom.Node n2 = n.getFirstChild();
String s1, s2;
while (n2 != null){
if(n2.getNodeName().equals("HorizontalPixelSize")){
org.w3c.dom.NamedNodeMap nnm = n2.getAttributes();
org.w3c.dom.Node n3 = nnm.item( 0 );
float hps = Float.parseFloat( n3.getNodeValue() );
xDPI = Math.round (25.4f / hps);
if(n2.getNodeName().equals("VerticalPixelSize")){
org.w3c.dom.NamedNodeMap nnm = n2.getAttributes();
org.w3c.dom.Node n3 = nnm.item( 0 );
float vps = Float.parseFloat( n3.getNodeValue() );
yDPI = Math.round (25.4f / vps);
n2 = n2.getNextSibling();
n = n.getNextSibling();
}
Similar Messages
-
How to find out the image resolution in illustrator?
How to find out the image resolution in illustrator cs through javascript or vbscript?
Thanks,
PrabudassAnyone please help me, how to find out the embedded image resolution in illustrator file through script.
Thanks,
Prabudass -
How to find out the image size?
How to find out the image size values(Width and height) in illustrator CS3 using any script. I tried but i got only the document height and width. I need to find out the image BoundingBox value of width and height. Kindly advice me.
Try this.
tell application "Adobe Illustrator"
set heightImage to get height of raster item 1 of current layer of current document
set widthImage to get width of raster item 1 of current layer of current document
display dialog (heightImage & " X " & widthImage) as string
end tell
JaiMS -
How to find out embedded raster image is Black&White or Color image?
Is there any possibility to find out the embedded raster image is Black&White, Gray image (or) Color image in "illustrator cs3" without using color mode shown in "document info" pannel. Kindly advice me, the possibilities and solution. And also any scripts avilable for this?
Thanks.Or you could select the embedded image, and open the Window>Document Info panel. Select Embedded Images from the fly out menu on the Document Info panel. This should give you the color mode and more info on the embedded file in question.
-
How see the original resolution of an image in Photoshop CC
I need to see the original resolution of a jpg, but when I go to Image size it is in much higher resolution. the jpg is about 600K which makes me suspect it is in 72 dpi, but when I open it in Photoshop CC it is about 23 MB and in 300 dpi. I need to know what the original is, and Image size is where I used to go to find out before I switched to CC. Does anyone know how I can check the original size and resolution?
I mean the size and resolution that the image was in when received it. I
had it as a jpg from my client, and have made no adjustments myself so
far. You are correct that I was just assuming that something must be
wrong. What puzzled me is that when I looked at the info about the
picture by right clicking on it, it was 600K, but when I opened it in
Photoshop it was 23 MB. What is the explanation for that?
2014-11-28 13:58 skrev c.pfaffenbichler:
HOW SEE THE ORIGINAL RESOLUTION OF AN IMAGE IN PHOTOSHOP CC
created by c.pfaffenbichler in Photoshop General Discussion -
View the full discussion -
How to find out which keywords were used to create a smart album?
Hi,
I actually have 2 questions;
a) Short of scrolling down my very long list of password on the HUD - is there an elegant way to do it - How to find out which passwords were used to create an existing smart album? It's a recurring challenge for me.\ 'cause I like using smart albums, but once in a while need to check or chane the passwords.
b) With annoying regularity when I try to get to this forum and choose Aperture, I get the following message - in pink, no less: It appears you're not allowed to view what you requested. You might contact your administrator if you think this is a mistake.
Any clues?
Thanks guys,
Raphael
<Edited by Host>b) With annoying regularity when I try to get to this forum and choose Aperture, I get the following message - in pink, no less: It appears you're not allowed to view what you requested. You might contact your administrator if you think this is a mistake.
Any clues?
Raphael,
that message may occur for four reasons at least:
Most frequently, when you are using an outdated link to a post that no longer exists, for example from an email notofication. Sometimes our community host will remove posts, that are in violation of the terms of use: see:
Apple Support Communities Terms of Use
Or you are using the edit button or a bookmark to an "Edit" window, after the fifteen minutes allowed for editing are up.
Or you want to view a page in a restricted section of the ASC - soem perta are only open for members of level 6 or higher.
Or it is one of the unexplained problems with the forum software right now.
a) Short of scrolling down my very long list of password on the HUD - is there an elegant way to do it - How to find out which passwords were used to create an existing smart album? It's a recurring challenge for me.\ 'cause I like using smart albums, but once in a while need to check or chane the passwords.
I really like Kirby's suggestion with the IPTC rule Keyword is. This is very useful for smart albums global to the library.
Frequently a different approach helps for my smart albums. Many of my smart albums are local to projects or folders. In this case the smart HUD will only show those keywords that have been used for the images in the selection. So if I only have tagged the images with the keywords "birds" and "slideshow", the smart settings HUD will only show these two keywords and the list is very short.
My Keywords HUD, is organized hierarchically; this way I can collapse large sections at once, and it is easier to focus on the keywords needed for a specific task.
I use the search field in HUD a lot, to filter the set of keywords shown. -
How to find out selected AssignedStory or Link?
Hello to all,
can anyone pls. explain how to find out which assigned story or link is selected at the time the script is fired.
My problem is this: I would like to place an image into selected rectangle which is exported into .icml. So, for example, you have few exported rectangles and you would like to place an image into the one which is selected (through link or assignment panel). Because you can not select a rectangle in InCopy like you can in InDesign I tried to take a look through assigned stories...
For aCounter As Integer = 1 To myDocument.Assignments.Count
Dim myAssignment As InCopy.Assignment = myDocument.Assignments.Item(aCounter)
For sCounter As Integer = 1 To myAssignment.AssignedStories.Count
Dim myAssignedStory As InCopy.AssignedStory = myAssignment.AssignedStories.Item(sCounter)
Dim myStoryRef As Object = myAssignedStory.StoryReference
find out if assigned story or story reference is selected
'Rectangle
If TypeName(myStoryRef) = "Rectangle" Then
Dim myObjectRectangle As InCopy.Rectangle = myStoryRef
If myObjectRectangle.Graphics.Count = 0 And myObjectRectangle.Images.Count = 0 Then
'CheckOut if needed
'Place Media
End If
End If
Next
Next
Kind regards,
MarkoWell,
I couldn't solve this without using a placeholder image. I found that you need to check if the selection is an image and than replace that image... So something like this below:
'Check if there is a selected image for relink
If myDocument.Selection.Count = 1 Then
If TypeName(myDocument.Selection.Item(1)) = "Image" Then
myImage = myDocument.Selection.Item(1)
myImageLink = myImage.ItemLink
Dim msgRet As MsgBoxResult = MsgBox("Would you like to relink selected image?", MsgBoxStyle.YesNoCancel, "Relink seleceted image?")
If msgRet = MsgBoxResult.Yes Then
' DO some action
Dim MediaLink As String = something...
'CheckOut action
If myCheckOutMenu.AssociatedMenuAction.Enabled() Then
myCheckOutMenu.AssociatedMenuAction.Invoke()
End If
myImageLink.Relink(fileLink)
Try
myImageLink.Update()
Catch
End Try
Hope this helps.
Regards,
Marko -
How to find out the locale setting in a browser?
In my Java web project, the multi-lingual issue on the JSP pages is handled by JSTL. It works fine so far for any input messages. However, some messages come from the container. It is needed to find out the browser's country and language settings inside of the container. My question is how to find out the settings?
Thanks in advance.
v.Hi, this I found on James' website--see http://www.rf.net/~james/perli18n.html#Q28
Q28. Can web servers automatically detect the language of the browser and display the correct localized page?
A28. Yes. HTTP/1.1 defines the details of how content negotiation works, including language content.
WWW browsers send an Accept-Language request header specifying which languages are preferred for responses. This technique works fairly well, although some versions of Netscape Navigator send an improperly formatted request parameter. Also, switching language preferences in either Navigator or IE 4 doesn't always "take" without first deleting a language hint.
Few sites do content-negotiation on language, and interestingly enough I do not know of any major portals doing this. One site that does is Sun's documentation library at SunDocs. Debian.org does a very nice job of using Apache content negotiation wih languages and also has some nice help info too on Setting the Default Language.
Apache's Content Negotiation features will select the right page to return, whether HTML or image file. Annoyingly, the match logic is very literal, so a browser request for en-us will not match a server entry of en except as a last resort. Any other exact match will win over en, even if en-us was first preference.
There are 2 ways of doing content negotiation with Apache: type or variant maps and multiviews.
Variant Maps
In httpd.conf, disable Options Multiviews if configured and add
AddType type-var var
DirectoryIndex index.var
Then create an index.var file like this:
URI: start; vary="type,language"
URI: index.html.en
Content-type: text/html
Content-language: en-GB
URI: index.html.en
Content-type: text/html
Content-language: en-US
URI: index.html.en
Content-type: text/html
Content-language: en
URI: index.html.fr
Content-type: text/html
Content-language: fr-CA
URI: index.html.fr
Content-type: text/html
Content-language: fr
URI: index.html.es
Content-type: text/html
Content-language: es
Multiviews
The multiviews technique works like this. This does add extra server load, as each content directory must be scanned for the variant document names.
index.html is localized into variant documents such as:
index.html.en (or index.en.html)
index.html.fr
index.html.es
index.html (or index.html.html as a reader has recommended) symlinked to one of the above as the last resort.
Here's an example of http.conf directives for this:
# in httpd.conf
AddLanguage en .en
AddLanguage fr .fr
AddLanguage es .es
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
# Just list the languages in decreasing order of preference.
LanguagePriority en es fr de pt
Options Multiviews
# end of httpd.conf fragment
Starting in Apache 1.2, you may also create documents with multiple language extensions.
O'Reilly's Apache - The Definitive Guide, Chapter 6
ApacheWeek article on Language Negotiation
Another ApacheWeek article on Language Negotiation -
How to find out the RasterItem(embedded) links name?
How to find out the RasterItem(embedded) links name which appeared in Links menu(Window->Links) via scripting for illustrator cs3. Please advise me the possibilities.
Thanks for looking into this.Thanks for your support. From your code i got the filename(embedded) with pathname(if the embedded image in that location). If the embedded image not in that location at that time it throws error message. Is it possible to find out the name of the embedded image, if the corresponding image not in that location. Kindly advise me the possiblitities.
Thanks for looking into this. -
UITableView section header: How to find out font size and background color
Hi, does anyone know how to find out the default font and default background color(or image?) used in the section header of a tableView
I'd like to create a view with the same background color/image and use the same font (with different color) used by the section headerI don't think there are any getter methods for a section header. But I wouldn't be surprised if the header was an object. You might try setting some header text to a key string and searching recursively through all the subviews for objects that respond to a text message. It might help to also print the description of objects that don't respond to text. I haven't tried this yet, but will let you know if I get any useful results.
I guess another approach would be to use viewForHeaderInSection to set the font and color to whatever you wanted. Then you wouldn't have any problem matching it. -
How to find out the user-exits?
hi.
how to find out the user-exits?
regards
eswar.Hi,
*& Report ZEXITFINDER
*report zexitfinder.
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits exists.
*& Tables
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
tstct. "Transaction Code Texts
*& Variables
data : jtab like tadir occurs 0 with header line.
data : field1(30).
data : v_devclass like tadir-devclass.
*& Selection Screen Parameters
selection-screen begin of block a01 with frame title text-001.
selection-screen skip.
parameters : p_tcode like tstc-tcode obligatory.
selection-screen skip.
selection-screen end of block a01.
*& Start of main program
start-of-selection.
Validate Transaction Code
select single * from tstc
where tcode eq p_tcode.
Find Repository Objects for transaction code
if sy-subrc eq 0.
select single * from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = tstc-pgmna.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
select single * from trdir
where name = tstc-pgmna.
if trdir-subc eq 'F'.
select single * from tfdir
where pname = tstc-pgmna.
select single * from enlfdir
where funcname = tfdir-funcname.
select single * from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = enlfdir-area.
move : tadir-devclass to v_devclass.
endif.
endif.
Find SAP Modifactions
select * from tadir
into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct
where sprsl eq sy-langu
and tcode eq p_tcode.
format color col_positive intensified off.
write:/(19) 'Transaction Code - ',
20(20) p_tcode,
45(50) tstct-ttext.
skip.
if not jtab[] is initial.
write:/(95) sy-uline.
format color col_heading intensified on.
write:/1 sy-vline,
2 'Exit Name',
21 sy-vline ,
22 'Description',
95 sy-vline.
write:/(95) sy-uline.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
format color col_normal intensified off.
write:/1 sy-vline,
2 jtab-obj_name hotspot on,
21 sy-vline ,
22 modsapt-modtext,
95 sy-vline.
endloop.
write:/(95) sy-uline.
describe table jtab.
skip.
format color col_total intensified on.
write:/ 'No of Exits:' , sy-tfill.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
Take the user to SMOD for the Exit that was selected.
at line-selection.
get cursor field field1.
check field1(4) eq 'JTAB'.
set parameter id 'MON' field sy-lisel+1(10).
call transaction 'SMOD' and skip first screen.
Regards -
How to find out the Transactions used per month & the USER who used that
Hi,
1)How to find out the Transactions used per month & the USER who used that?
2)and can i get the above same for minimum 20 month?
System : SAP- Enterprise Core Component.You can use my program...
*& Report Z_ABAP_TCODE_MONITOR
*****& Program Type : Report *
*****& Title : Z_ABAP_TCODE_MONITOR *
*****& Transaction code : ZTCODE_USAGE *
*****& Developer name : Shailendra Kolakaluri *
*****& Deveopment start date : 26 th Dec 2011 *
*****& Development Package : ZDEV *
*****& Transport No : DEVK906086 *
*****& Program Description : This program is to display
*List all tcodes executed during previous day.
*& Show the number of users executing tcodes
*& Modification history
REPORT Z_ABAP_TCODE_MONITOR.
*& List all tcodes executed during previous day.
*& Show the number of users executing tcodes
TYPE-POOLS : slis.
DATA: ind TYPE i,
fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
layout TYPE slis_layout_alv,
variant TYPE disvariant,
events TYPE slis_t_event WITH HEADER LINE,
heading TYPE slis_t_listheader WITH HEADER LINE.
*REPORT z_report_usage.
TYPES: BEGIN OF zusertcode,
date TYPE swncdatum,
user TYPE swncuname,
mandt TYPE swncmandt,
tcode TYPE swnctcode,
report TYPE swncreportname,
count TYPE swncshcnt,
END OF zusertcode.
*data : date type n.
DATA: t_usertcode TYPE swnc_t_aggusertcode,
wa_usertcode TYPE swncaggusertcode,
wa TYPE zusertcode,
t_ut TYPE STANDARD TABLE OF zusertcode,
wa_result TYPE zusertcode,
t_result TYPE STANDARD TABLE OF zusertcode.
PARAMETER: month TYPE dats DEFAULT sy-datum.
*PARAMETER: date TYPE dats.
*select-options : username for wa_usertcode-account.
START-OF-SELECTION.
PERFORM get_data.
PERFORM get_fieldcatalog.
PERFORM set_layout.
PERFORM get_event.
PERFORM get_comment.
PERFORM display_data.
FORM get_data .
*date = sy-datum - 2 .
After start-of-selection add this line (parameter Month required 01 as day).
concatenate month+0(6) '01' into month.
CALL FUNCTION 'SWNC_COLLECTOR_GET_AGGREGATES'
EXPORTING
component = 'TOTAL'
ASSIGNDSYS = 'DEV'
periodtype = 'M'
periodstrt = month
TABLES
usertcode = t_usertcode
EXCEPTIONS
no_data_found = 1
OTHERS = 2.
wa-date = month.
*wa-date = date.
wa-mandt = sy-mandt.
wa_usertcode-account = username.
LOOP AT t_usertcode INTO wa_usertcode.
wa-user = wa_usertcode-account.
IF wa_usertcode-entry_id+72 = 'T'.
wa-tcode = wa_usertcode-entry_id.
wa-report = space.
ELSE.
wa-tcode = space.
wa-report = wa_usertcode-entry_id.
ENDIF.
COLLECT wa INTO t_ut.
ENDLOOP.
SORT t_ut BY report ASCENDING.
CLEAR: wa, wa_result.
endform.
FORM get_fieldcatalog .
fcat-tabname = 't_ut'.
fcat-fieldname = 'DATE'.
fcat-seltext_l = 'Date'.
fcat-key = 'X'.
APPEND fcat.
CLEAR fcat.
fcat-tabname = 't_ut'.
fcat-fieldname = 'MANDT'.
fcat-seltext_l = 'Client'.
fcat-key = 'X'.
APPEND fcat.
CLEAR fcat.
fcat-tabname = 't_ut'.
fcat-fieldname = 'USER'.
fcat-seltext_l = 'User Name'.
fcat-key = 'X'.
APPEND fcat.
CLEAR fcat.
fcat-tabname = 't_ut'.
fcat-fieldname = 'TCODE'.
fcat-seltext_l = 'Transaction Code'.
fcat-key = 'X'.
APPEND fcat.
ENDFORM.
*& Form SET_LAYOUT
text
--> p1 text
<-- p2 text
FORM set_layout .
layout-colwidth_optimize = 'X'.
ENDFORM. " SET_LAYOUT
*& Form GET_EVENT
text
--> p1 text
<-- p2 text
*FORM get_event .
events-name = slis_ev_top_of_page.
events-form = 'TOP_OF_PAGE'.
APPEND events.
*ENDFORM. " GET_EVENT
**& Form GET_COMMENT
text
--> p1 text
<-- p2 text
*FORM get_comment .
DATA: text(30).
text = 'Billing Report'.
heading-typ = 'H'.
heading-info = text.
APPEND heading.
*ENDFORM. " GET_COMMENT
**& Form top_of_page
text
--> p1 text
<-- p2 text
*FORM top_of_page .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = heading[]
I_LOGO =
I_END_OF_LIST_GRID =
*ENDFORM. " top_of_page
*& Form DISPLAY_DATA
text
--> p1 text
<-- p2 text
FORM display_data .
sort t_ut[].
DELETE ADJACENT DUPLICATES FROM t_ut[] COMPARING ALL FIELDS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
is_layout = layout
it_fieldcat = fcat[]
i_save = 'A'
is_variant = variant
it_events = events[]
TABLES
t_outtab = t_ut
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DISPLAY_DATA -
How to find out the person who did a transport.
How to find out the person who did a transport.
There are 3 basis admins in our Org.
so is there a way of tracing out , who did what transport.
Regards,- Goto import Overview (STMS)
- Import Queue
- Select DEV req (goto Import History)
- Edit - Display More
It will show the user who did the transport
Rgds -
How to find out the user who has created a new field in the custom table.
How to find out the user details who has created a new field in the custom table.
Thanks,
JoanHi Jesudasan ,
You can know the user details with version management.Please find the
below procedure to know.
Go to table->Utilities tab->version->Version management->Compare the previous one .
Hope this solves the issue,Let me know if you have any issues.
Thanks,
Rajani -
How to find out web-inf path from the physical drive?
How to find out web-inf path from the physical drive?
I have some user profiles in web-inf directory.SO I want to know the path from root directory like
d:/program files/allaire/jrun/appname/web-inf/profiles/username like that.
Presently I am able to get the path upto the application directory and from that I am concatinationg web-inf/profiles/username .
But it is giving problems when it is deployed under unix or linux.Because web-inf there it treats as WEB_INF
SO I want to get the path of web-inf directory with out hard coding.
ThankuString path = application.getRealPath("/WEB-INF/profiles/username");
Note sure why you need this, but you don't need the real path to read the file - you can get an InputStream using the relative path. See ServletContext getResource() and getResourceAsStream().
Maybe you are looking for
-
Issues with Creative Cloud for teams deployment workflow
The Adobe Creative Cloud for teams IT Deployment Guide lists out steps for IT admins to deploy the CS6 applications and then have their end-users license the trial software with their Adobe IDs once they have been invited to the team. There are two m
-
Error in reports after upgrade from OBIEE 10g to 11g : [nQSError: 14025]
Hi All, We upgraded RPD and web catalog from OBIEE 10g to 11.1.1.5. I see the following error while running few reports. Error: State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] M
-
Error while creating a sales order BAPI_SALESORDER_CREATEFROMDAT2
Hi All, I am using the BAPI BAPI_SALESORDER_CREATEFROMDAT2 to create a sales order. I am passing all the required fields and also the rejection code at the item level. Also I am using a variant configuration material and hence ai am filling the VC co
-
Service order number range creation
Hi, Could anyone please tell me how can we create service order number range if we have done a new service order type creation, and what should we do: should we create the number range in development and then transport it to the production or we shou
-
Plsql datatype -- URGENT HELP..
Is there a plsql datatype i can declare which can hold > 32k bytes value. please note that data value is not coming from database. rather i will be getting it from an OUT variable of an external program call from plsql stored procedure. THANKS.