Converting the sample model type from USHORT to BYTE

Hi,
We're converting TIFF images into JPEGs and loading them into a database. This works except for cases where the SampleModel datatype of the image is USHORT when it throws:
java.lang.RuntimeException: Only 1, or 3-band byte data may be written.
at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:145)
The fact that it is not BYTE data is the problem I think. The image has 3 bands (see image details below this post).
Does anyone know how to convert the USHORT to BYTES? Any other suggestions are also welcomed.
GDAL_INFO tool tells us the following about the image
C:\dmp>gdalinfo OsloQB1_1.tif
Driver: GTiff/GeoTIFF
Files: OsloQB1_1.tif
Size is 7847, 7768
Coordinate System is:
PROJCS["UTM 32 V E012",
GEOGCS["unnamed",
DATUM["unknown",
SPHEROID["unretrievable - using WGS84",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4030"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",9],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (590809.199999999950000,6656298.599999999600000)
Pixel Size = (0.600000000000000,-0.600000000000000)
Metadata:
AREA_OR_POINT=Area
Corner Coordinates:
Upper Left ( 590809.200, 6656298.600) ( 10d37'47.39"E, 60d 2'1.81"N)
Lower Left ( 590809.200, 6651637.800) ( 10d37'39.98"E, 59d59'31.21"N)
Upper Right ( 595517.400, 6656298.600) ( 10d42'51.44"E, 60d 1'57.97"N)
Lower Right ( 595517.400, 6651637.800) ( 10d42'43.65"E, 59d59'27.37"N)
Center ( 593163.300, 6653968.200) ( 10d40'15.62"E, 60d 0'44.62"N)
Band 1 Block=7847x1 Type=UInt16, ColorInterp=Red
Band 2 Block=7847x1 Type=UInt16, ColorInterp=Green
Band 3 Block=7847x1 Type=UInt16, ColorInterp=Blue

that means we are loosing high order bits Of course, you are trying to jam 10 bits into an 8 bit container
so how come the most significant bit is carrying 1 to represent negative value.bytes in java are signed

Similar Messages

  • I want to convert the quantity(datau2019s type - QUAN) in words.

    Hi All,
    I want to convert the quantity(datau2019s type - QUAN) in words.
    I am using function module SPELL_AMOUNT. But I donu2019t use input parameter u201CCURRENCYu201D because I use the quantity instead of amount.
    But my problem is when i pass quantity value such as 195.500 without input parameter u201Ccurrencyu201D its just giving me output as ONE HUNDRED NINETY-FIVE THOUSAND FIVE HUNDRED in the field u201CSPELL-WORDu201D( the field u201CSPELL-DECWORDu201D is empty) instead of ONE HUNDRED NINETY-FIVE in the field u201CSPELL-WORDu201D and FIFTY in the field u201CSPELL-DECWORDu201D.
    DATA:
      v_fkimg1 TYPE vbrp-fkimg value '195.500',
      wa_spell TYPE spell.
      CALL FUNCTION 'SPELL_AMOUNT'
        EXPORTING
          amount    = v_fkimg1
          filler    = ' '
          language  = sy-langu
        IMPORTING
          in_words  = wa_spell
        EXCEPTIONS
          not_found = 1
          too_large = 2
          OTHERS    = 3.
      write: / wa_spell-word, wa_spell-decword.
    What should i do to solve this problem.
    Is there any other fn module or am i giving some wrong input?
    Plz suggest me.
    Regards,
    Sergey.

    Hi,
    Use FM 'HR_IN_CHG_INR_WRDS' as follows :
    CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
    EXPORTING
    amt_in_num = b
    IMPORTING
    amt_in_words = a
    EXCEPTIONS
    data_type_mismatch = 1.
    This will give you amount with decimal values as well but here there is another problem like if u give input as 19.50 it gives output as :
    NINETEEN RUPPESS FIFTY PAISE.
    May be after out put can do operation like find string and delete rupees and paise from the that.
    Hope this would be of some help!!!
    Regards,
    Lalit Kabra

  • Itunes 10.6.1.7 problem: when I change the file "media type" from 'Music' to 'Podcast' the file disapears from ITUNES. I do this via (1) right click, (2) select 'Get Info', (3) select 'options' tab, and (4) change media type. What is the problem?

    Itunes 10.6.1.7 problem: when I change the file "media type" from 'Music' to 'Podcast' the file disapears from ITUNES. I do this via (1) right click, (2) select 'Get Info', (3) select 'options' tab, and (4) change media type. What is the problem?

    Hi Memalyn
    Essentially, the bare issue is that you have a 500GB hard drive with only 10GB free. That is not sufficient to run the system properly. The two options you have are to move/remove files to another location, or to install a larger hard drive (eg 2TB). Drive space has nothing to do with SMC firmware, and usually large media files are to blame.
    My first recommendation is this: download and run the free OmniDiskSweeper. This will identify the exact size of all your folders - you can drill down into the subfolders and figure out where your largest culprits are. For example, you might find that your Pictures folder contains both an iPhoto Library and copies that you've brought in from a camera but are outside the iPhoto Library structure. Or perhaps you have a lot of purchased video content in iTunes.
    If you find files that you KNOW you do not need, you can delete them. Don't delete them just because you have a backup, since if the backup fails, you will lose all your copies.
    Don't worry about "cleaners" for now - they don't save much space and can actually cause problems. Deal with the large file situation first and see how you get on.
    Let us know what you find out, and if you manage to get your space back.
    Matt

  • Change the backend doc type from PR to PO in BADI BBP_TARGET_OBJECTS.

    Hi,
    We have followed below approach for backend document type determination.
    1. A custom function module contains the logic to determine the backend document type of a Shopping cart line item. THis function module, performs many checks and hence cannot be called in any BADI that is executed in Foreground.
    2. I am using BADI BBP_TARGET_OBJECTS to change the follow document type by calling the custom function module.
    Issue here is, if the backend document type of a line item is Purchase requisition (2) by SAP standard, and if I try to change it to Purchase order, it gives run time error and ends up in creation of Purchase order.
    After further investigation I found that this line item (with default backend doc type as 2) has a desired vendor. If we change the desired vendor of this line item to fixed(To Partner function 19 from partner function 39), it allows us to change the doc type from Purchase requisition to purcahse order in BADI BBP_TARGET_OBJECTS.
    But changing the partner function is possible only in BBP_DOC_CHANGE BADI, and I cannot call the custom function module there, as it may impact the performance.
    Is there any other way, I can change the partner function in any of the BADIs called in background?
    Or Is there any way by which I can change the backend document type from PR to PO in BBP_TARGET_OBJECTS?

    Hi Parab
    if you swaping 39 to 19 viadoc change badi
    REQUESTER has a control on Purchase ORDER Vendor and BUYER lost a control so your business has to decide.In this case procurement department lost their control.
    Fixed vendors are like inforecord and contract negotiated for best price ..
    Muthu

  • Please convert the attached vi's from V8.6 to V8.5

    Hi,
    Please convert the attached vi's from V8.6 to V8.5.
    Thanks so much!
    Ed
    Solved!
    Go to Solution.
    Attachments:
    COMSelect_86.zip ‏21 KB

    Here you go.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    COMSelect_85.zip ‏20 KB

  • Unable top convert the status of idoc from 03 to 12

    Hi experts,
    I am working on idoc scenario on ECC6.0.I am pushing the idoc from R/3 system to PI7.0.I have done all the prerequisites involved to pushing idoc-----
    maintain Rfc destinations,maintain port,partner profile,distribution model....
    But when i am pushing the reduced idoc from sender it's showing the status 03.when i am running RBDMOIND in se38 still it is not getting converted into 12.
    kindly help me how can I convert the status from 03 to 12.
    Thanks in advance.
    Regards,
    Naresh.K

    Hi Naresh
    you have to create the service. Create first the technical system and the business system in the SLD. Look for the right "Logical System" (Transation SALE in R3).
    In the Integration Builder Directory go to "Environment/Clear SLD Data" and create the service by "Objects/Service without party/Business System/Assign Business System".
    Hope this will solve your Querry
    Thanks !!
    Questions are welcome here!!
    <b>Also mark helpful answers by rewarding points </b>
    Regards
    Abhishek Agrahari

  • How can we derive the Abs quota type from absence type?

    we need to develop a report where we need to fetch Abs quota type from abs type.
    I checked T554S, we can get counting rule from it and then T556C and then to assigned deduction rule in table T556R.
    From T556R, qota type is there but the field is ABWKO and it is structure. How do read values from deduction rule.
    we need KTART field which is in V_T556A.

    Hello,
    Did you find the solution to your problem?
    Kr,
    Julien

  • Error in accessing the sample application content from the OBIEE 11g

    I installed OBIEE 11g + Oracle 11g database on one machine. Everything went smoothly with no issues.
    I can connection to the database from SQLPLUS.
    Then I followed instructions to deploy sample app. After everything is done, when I try to access the dashboards, reports etc from the OBIEE 11g home page , I get the error below.
    I am stuc kand dont know how to proceed. I verified tnsnames.ora and everything seems good.
    In the SampleAPp.RPD, I set DB_SID as "ORCL" and DB_HOST as my computer name (along with domain name). No idea how to proceed from here..
    I really appreciate any help.
    Odbc driver returned an error (SQLExecDirectW).
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle Error code: 12541, message: ORA-12541: TNS:no listener at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
    Thanks

    Thanks for the replies.
    1) Was the oracle installed in multiple instances ? if yes set the Variable path correctly pointing to your right folder
    Yes, oracle had multiple instances. I tried copying the tnsnames.ora from my oracle home to the Oracle_BI1/network/admin directory as 11g apparetnly comes with a Oracle client as BIFACTs suggested in his/her reply. I put the same in the path variable
    2) Try to ping the service_name tnsping service_name(SID) from command prompt
    This works.
    3) check whether you may have "white spaces" in tnsnames.ora file at starting of entry
    No white spaces appeated
    I still see the same issue! I logged in as developer credentials as mentioned the sample app documentation.
    I get the same "cannot connect to database" error.
    I once in a while see an issue with javahost not starting. Not sure what is the impact of javahsot not running and all the other managed processes running.
    Please help....

  • Is it possible to convert the Dialog Resource File from Windows .rc to Mac .r ?

    Hello,
    I have been working my way through the ADM Programmer's Guide and Reference, found at http://partners.adobe.com/public/developer/en/acrobat/sdk/ADMReferenceGuide.pdf
    It mentions that the dialog resources must be created using platform-native resource editors. Since my company would like to implement its plugins on both mac and windows, it would be smarter to convert the windows framework .rc file to the mac counterpart .r.
    Does anyone know of such a tool? Maybe the compilation process creates a common dialog resource file which could be used once the dialog is created under Visual Studio, etc.
    Sincerely, Andreas Hase

    The link in this thread is broken, can someone give the title of the thread where converting from .rc to .r is being discussed?

  • How do I control the sample you view from a published iBook?

    Sorry if this is in the wrong section but couldn't find a section on iBook publishing.
    I now have 17 children's illustrated books on the iBook library and they all look great on an iPad. The problem is the sample a potential viewer can download; it is just 2 pages. You get the cover and then the page showing the purchase link. I am getting quite a few sales now but imagine how many I am losing if you can't see a sample of the book.
    I contacted Lulu who publish them but they seem oblivious to a fix. They keep referring me back the the preview on their site but that is what you see on the web. I made an epub file with a few of the pages from the book and upoaded it but still, i get just the cover in the sample.
    This is really frustrating and no one seems to know how to fix it. Certainly seems to be nothing I can do at my end.
    Any ideas?
    Thanks in advance for any and all assistance.

    Sorry I do not have an answer, but I would like to see your books.  What is the title.  Splinters69 yields no search on iBooks.  I would love to learn more on how you published and if lulu was worth it

  • Convert/Cast string data type from file to DT_GUID into table

    Hi to all
    is there anyone who help me please?!?
    I'm not able to resolve the following problem.
    I have a .csv file with a string field A and its values are GUID.
    I must export this .csv file into SQL Server Table which have a uniqueidentifier (GUID) field B.
    I must map string field A to GUID field B of table.
    But I get an error like this: "Error at Data Flow Task [Derived Column [xxx]]: Error code 0x800401F3 occurred attempting to convert from data type DT_WSTR to data type DT_GUID.".
    I read other posts like this in this forum and i also tried the solution suggested in those posts.
    The proposed solution had suggested of insert in the expression field of "Derived Column" Transformation this expression (DT_GUID) ("{" + [YourGuid] + "}") in place of (DT_GUID) [YourGuid].
    But i get always the same error.
    is there anyone who help me please to resolve this issue?!?

    The derived column expression should work if the yourGuid column contains a real guid.
    Does the source looks something like: 25892e17-80f6-415f-9c65-7395632f0223
    And are all rows filled with a correct value or are there also empty strings or null values?
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • Substituion of the FI Document type from MM posting

    Dears,
    we are actually in the need of posting movement type 562 and would like to assign a specific document type when certain conditions are met.
    In transaction OMBA document type WA is associated to the goods receipt (which is the task that is being carried out with movement 562) and we would like to substitute it with a custom document type when posting the document that meet particular criteria such as Plant and G/L account.
    I have tried to create a substitution from standard transaction OBBH but, if I create it at line item level, I am not able of selecting the BLART field (since it is part of the header data) while if I create it at header level I do not have the necessary information (such as plant and G/L account) and it's not possible to select the document type as a field to be substituted.
    Do you think that it would be possible to achieve my objective by creating a substituion at line item level that has, as prerequisite, the plant and G/L account, and a UEXIT as substitution?
    Do you have any other suggestion to solve this issue?
    Thanks and best regards
    Davide

    Hello Davide,
    You can try to change the attribute to the BLART and make it subsitutable (by maintaining VWTYGB01 view via SM30) and build your subsitution on complete document, but I doubt if SAP will allow to substitute such sensitive field.
    Regards,
    Eli

  • How do I change the http connection type from close to keep-alive

    I am using a browser that appears as though it needs a connection type of keep-alive. When a page is requested the server sends back a connection type of close. It appears images are not requested from the server when this connection type is requested.

    Some older web server provides inaccurate content-length information.If the content length value is less than the amount of data,the web server treats the difference as a new request, this creates problem with iplanet Web Server.
    If you are using browser with HTTP1.1 enabled, choose the option to enable it manually and try once again by posting the request.
    Hope it helps.

  • Where is the "Sample Music" folder from iPhoto located?

    Please help me find this folder, I don't know where in my hard drive it might be.
    Thank you.

    It's located in the iPhoto (the application)/Contents/Resources/Music folder.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance. iPhoto doesn't not have to be closed to run it, just idle.
    I've written an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • How get the correct generic type from Class.forName()?

    I have:
    public class Test2 {
        void foo() throws ClassNotFoundException {
            Class<Test2> c = Class.forName("Test2");
    }Of course, this doesn't compile:
    javac -Xlint Test2.java
    Test2.java:4: incompatible types
    found   : java.lang.Class<capture#965 of ?>
    required: java.lang.Class<Test2>
            Class<Test2> c = Class.forName("Test2");Other than casting to Class and suppressing the unchecked warning, how can I get the code to do what I think should be a common use case? I try
    public class Test2 {
        void foo() throws ClassNotFoundException {
            Class<Test2> c = Class.forName("Test2").asSubclass(Test2.class);
    }Which doesn't compile either:
    javac -Xlint Test2.java
    Test2.java:4: incompatible types
    found   : java.lang.Class<capture#400 of ? extends Test2>
    required: java.lang.Class<Test2>
            Class<Test2> c = Class.forName("Test2").asSubclass(Test2.class);Not sure I understand what the javac error is about.
    Help!

    kinmanc wrote:
    This is just a simplified version of what I had. The name of the class being loaded is unknown at compile time, though it is known to implement an interface. Isn't this a common use case?Yes, its' quite common.

Maybe you are looking for