Decoding image from a byteArray

I don't know if this is possible (haven't seen it done
anywhere). Is there a way to decode a Base64 string back into a
ByteArray and subsequently into a Bitmap so that it can be
displayed within Flash?
I have successfully been able to encode the BitmapData into
PNG via a PNGEncoder class. This results in a ByteArray which I
have encoded using a Base64 class.
Any help much appreciated.

this seems to do what you were asking.
http://nightlycoding.com/index.php/2012/05/as3-send-bitmapdata-to-backend-efficiently/
source incase the link goes down in the future:
public static function deconstructBitmap(bmp:BitmapData):Object
            // converting the bitmapdata into a byteArray
            var byteArray:ByteArray = bmp.getPixels(bmp.rect);
            // compressing using the default algorithm 'zlib'
            byteArray.compress();
            var enc:Base64Encoder = new Base64Encoder(); 
            var b64;
            enc.encodeBytes(byteArray);
            // joining all in one line
            b64 = enc.drain().split("\n").join("");
            // the rectangle is needed for re-contstruction
            return {'bmpData':b64,'rect':bmp.rect};
public static function constructBitmap(obj:Object):BitmapData
            // to avoid errors
            if(obj!==''&&obj!==undefined&&obj!==null&&obj.bmpData!=='ByteArray'){
                var dec:Base64Decoder = new Base64Decoder();
                dec.decode(obj.bmpData); // decoding using the same algorithm
                var newByteArr:ByteArray=dec.toByteArray();
                newByteArr.uncompress();
                // end of decoding //
                var bitmapData:BitmapData = new BitmapData(obj.rect.width, obj.rect.height);
                bitmapData.setPixels(bitmapData.rect, newByteArr);
                return bitmapData;
            else
                return null;

Similar Messages

  • Error #2148 when loading image from ByteArray (not network or file)

    Hi!
    When I try to access bitmap data of Image loaded from ByteArray, I receive the following error:
    Error #2148: SWF file file:///C|/blablabla..../MyFlash.swf cannot access local resource file:///C|/blablabla..../MyFlash.swf/[[DYNAMIC]]/2. Only local-with-filesystem and trusted local SWF files may access local resources.
    I'm on Flash, not on AIR. And ByteArray contains PNG data which I prepare myself
    I tried to do it with Image.load and loader.loadBytes - the error is the same. I tried to use Flex SDK 3.4, 3.5 & 3.6 - nothing helps.
    When I add this image to my stage, it is displayed absolutely OK, but I still can't access bitmapData of this image - always got the same error.
    Flash Player 10
    Here are the samples of my code:
              public function onLoadComplete(event:Event):void
                var loader:LoaderInfo = event.target as LoaderInfo;
                var bmp:Bitmap = loader.loader.content as Bitmap; <-- here I received the error
                var bmpDat:BitmapData = bmp.bitmapData;
                this.bitmapData.copyPixels(bmpDat,new Rectangle(0,0,width,height), new Point(0,0));
                var loader:Loader = new Loader();
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
                loader.loadBytes(byteArray);
    And another try
           var image: Image = new Image()
           this.addChild(image);
           image.addEventListener(FlexEvent.UPDATE_COMPLETE, onCompleteLoad2 );
          image.load(byteArray);
          public function onCompleteLoad2 (e:flash.events.Event):void
                     var image:Image=e.target as Image;
                     var bitmapData:BitmapData;
                     bitmapData=new BitmapData(image.width,image.height,true,0);             
                     bitmapData.draw(image); <-- here I received the error, while image is correctly added to the stage and displayed
    What's wrong? It seems, the image loaded from byteArray is treated as local resource. How can I overcome it inside the code? Because this .swf is
    run on different computers and I can't just add a flash security exception on every of them....
    Please, help I spent, maybe 20 hours and still can't find the solution

    I had the same problem, except I was reading in the image from the local disk using FileReference.  Anyway, my issue was resolved by using the
    -use-network=false option on the command line of my compiler (I do all my development in the shell using 'vi' to edit and mxmlc to compile).
    Ttry "-use-network=false" and see if that helps...
    ...bob...

  • Loading image from database

    Hi all,
    The structure of my application is :
    - a flex client
    - a tomcat server
    - a mysql database
    I use hibernate to retrieve my objects from the database.
    I'm trying to have the flex client display images loaded at
    runtime from the database. Those images are stored as byte arrays
    (byte[]) and were produced in java with the following type of code
    : ImageIO.write(myBufferedImage, "PNG", myByteArrayOutputStream);
    so those byte arrays pretty much represent the content of a png
    image file.
    Is there any chance I might be able to produce a BitmapData
    out of the ByteArray instance I'll retrieve on the flex side or
    should I rely on some kind of a decoder ? Another solution could be
    to rewrite my storing mechanism but I'm trying, as much as
    possible, to avoid having to modify my current database content ;)
    Thanks in advance,
    Pierre.

    Thanks for the quick response.
    quote:
    Yes. Sure, this should work. Have you tried it? Are you
    having any problems?
    Actually, I haven't.. yet (I'm currently migrating this
    project from echo2 to flex and I haven't reached the point where I
    can really test anything). I should be able to create a prototype
    quickly though ;) .
    quote:
    Easiest check would to start off with <Image> component
    and set it's url to the servlet that's pumping image bytes and see
    if it displays it right. ATTA
    Good idea... Thanks for the pointer. My first intention was
    to directly use the ByteArray retrieved through FDS to create some
    kind of an image, client side but, as you mentioned Image, I read
    through the code of both this class and its parent class SWFLoader.
    It turns out that this class relies on the use of a Loader
    (couldn't find the source ;( ). It's kind of a pity that there
    should be no obvious means to directly feed the Image instance with
    the content (or the Loader, if that's where the PNG decoding
    occurs) through a ByteArray format. Anyway, your suggestion of
    creating a Servlet to retrieve the image content is indeed a good
    idea. I should be able to store some kind of an image id in my
    object that I could use as a parameter of the servlet's url. So
    much for trying to leave my current database intact but I can't
    think of any other way, considering my very small current knowledge
    of the whole flex framework.
    Thanks again for the tip. I'll come back later on with the
    results of my tests...
    Pierre.

  • Figuring out how to extract images from a PDF file

    Hi,
    I'm trying to write a small app that extracts all images from a PDF file. I already wrote a nice parser and it works good but the only problem is that I can't quite figure out from the reference how to decode all images in a PDF file to normal files such as tiffs, jpegs, bmps etc. For now I'm focusing on XObject images and not dealing with inline images.
    From what I understand so far just by trying and looking at open sources I figured that if I see a XObject Image with a DCTDecode filter, taking the stream data without doing anything to it and saving it as a jpeg file works. But doing the same to FlateDecoded streams or CCITTFax didn't work.
    What is the right way to properly extract the images?

    In general you have to
    * decode the stream
    * extract the pixel data
    * use ColorSpace, BitsPerComponent, Decode and Width to unpack pixel
    values
    * reconstruct an image file format according to its specification
    There are no other shortcuts. The DCTDecode shortcut (which doesn't
    work for CMYK JPEG files) is just a piece of fantastic good luck.
    Aandi Inston

  • How to pass an image from the mobile application to the Adobe Media Server?

    The image is taken as photo from the CameraUI in the Client Side(AIR Mobile Application) and saved as a .jpg file in the mobile. I passed the image byte array values from the client to the server. How to convert that byte array to a file in the Adobe Media server?

    This is very similar to the problem here:
    http://forums.adobe.com/thread/655314
    processByteArray = function(byteArrayAsPlainObject){
         // byteArrayAsPlainObject is an object serialized from a ByteArray but without functions
         // we need to get a ByteArray that we can call functions on
         var usableByteArray = new ByteArray();
         byteArrayAsPlainObject.position = 0; // make sure we start from the beginning
         ByteArray.prototype.readBytes.call(byteArrayAsPlainObject, usableByteArray);
         // now usableByteArray contains what was in the original argument, but we can actually use it on the server side

  • Display image from database with jspSmart

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    I call this JSP from another JSP like this:
    <img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
    If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
    Please help
    Sajid

    I think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
    the getphoto.jsp PhotoId.
    /** getphoto.jsp source code */
    <%@page import="java.sql.*,oracle.jdbc.*"%>
    <html>
    <head>
    <title>
    jsp1
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="781" border="2">
    <tr<<td>
    <td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
    <%
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select photo_id,photo_description from photo");
    while (rset.next()) {
         %>
         <tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
         <%
    conn.close();
    %>
    </table>
    </body>
    </html>
    /** getimage.jsp source code */
    <%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
    <%
    String strConnString = null;
    Connection oDbConn;
    Statement oStmt;
    ResultSet oResult;
    String strConnection = null;
    String strUserId = "c_erober";
    String strUserPwd = "sybdev99";
    String strDatabase = "oraITAS";
    String strPhotoId;
    strConnString = "jdbc:odbc:" + strDatabase;
    String strSql;
    try {
    strPhotoId = (String) request.getParameter("PhotoId");
    strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
    oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
    response.setContentType("image/jpeg");
    oStmt = oDbConn.createStatement();
    oResult = oStmt.executeQuery(strSql);
    oResult.next();
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = oResult.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    while((size=sImage.read(bytearray))!= -1 ) {
    response.getOutputStream().write(bytearray,0,size);
    response.flushBuffer();
    sImage.close();
    oDbConn.close();
    } catch (SQLException ex) { ex.getMessage();
    %>

  • Extracting Images from EPS - Problem with the Output

    Hello,
    I got a big problem extracting images from an EPS, which has been made in InDesign. The image does not appear correct.
    Source code:
    %ALDImageFileName: Speicher:image.jpg
    %ALDImageDimensions: 30 30
    %ALDImageCropRect: 0 0 30 30
    %ALDImageCropFixed: 0 0 30 30
    %ALDImagePosition: 203.8677 344.8913 203.8677 359.2913 218.2677 359.2913 218.2677 344.8913
    %ALDImageType: 4 8
    %%BeginObject: image
    [14.4 0 0 14.4 203.868 344.891 ]ct
    snap_to_device
    Adobe_AGM_Image/AGMIMG_fl cf /ASCII85Decode fl /RunLengthDecode filter ddf
    <<
    /T 1
    /W 30
    /H 30
    /M[30 0 0 -30 0 30 ]
    /BC 8
    /D[0 1 0 1 0 1 0 1 ]
    /DS [
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    [AGMIMG_fl 30 string /rs cvx /pop cvx] cvx
    /O 3
    >>
    %%BeginBinary: 1
    img
    p&G-p!<E*"!<<3"!!!&i!!30$!Vl`q!V$-m!WW3&!r`0#!Wh]h!!20]!WW3$qZ$^!!!!&f!!30$!WE'!
    !WE'$!<<*#nc/[l!W<!#!WW3%h>dNVnGiXl!<<-)!!*'"!<<2f!<*$!!<3)a!!!&t!!*-%kl:\ar;Zm"
    !!2He#6G2G(D[>Z!<*#e!!WKUEK,/l!r`0"!V$.!!Wi?'-t[mD-NjDN!!2Zk!!3#u"T\]4$OR%8!!!&h
    !!<6)*\I@D!\,8pq>g3h%KQP0';ta-rr2ho&-2b3mf3Y*Q/q,jk2D[9"76'h!=o#B!Y,22n,Nn!!!=Q!
    0.ee,0/"XS!VHHl!!E<'!"[l]rrUsd!Ug!r&'a/!k3(mej38#8mJm8&'`/UF'`J.(!"8l.+"o,p/hSe-
    /M8.8!!<6%!i#Yn!<2rs!2Ao^$NZFPk2tpjkND!jP3r;O%29TU'`o-b%e'H-!=:8,0/"h-.kN>(.gkeH
    "T^(Js8W&srrE$$rr;gE!V-4"""*$ljlY^djQYmmi$\'q!W`9(p([Q1nc/dn!#@(:r[nC..kE8)/emgU
    !<IHErs8W(rr<#trr76B!:p1!CZadBk2kmhj65^iD"%E-$5O?k'`&OE$M"0,!<<uh0.ee0/h\e,/h.k2
    !!*+arVm-$s8W)us8J2U!;Z[(L?.U[kN:sflf@0hK^f$D!=T\>'a5?f'c%2YnGit6/1iM*/1iA*.kWFi
    nc/dn!I+SBqYpWrrcdo5!<N60C$4[@ki_*hl0.?lD".K0!=9MV'c%S_'`f!Vnc01&!!t50/M8P+/h8J)
    .gH+F!!+PDrVllsrVlrp.KT,@#QauQip#Ifk3*$4ki:gb-3Nc<$j.4Z'GV>s'bqJt('F(,%06GL/hJ_.
    .k<;..j"f]!!32!rql]tr;WMmmf3c`k2tsgk2tmikEZ,Kn,NJ!'`/UJ'G_,X!V-6i!=L8*/2&S./M&=P
    !!2Ti"9AV]s8N#t"o\JY&c_t$!"-g0j6,RdkNBr!!r2ii!!!]1'a,9f'*84(!"Ar/""YuT/M8Y)!WW3$
    nc0%!!!!Z$s8N#ts76`i!"T,3!!3\bl0.?qjkC7H!!;`lrW!!#!>PMJ!u;Ub!Ug$f!=JlU/M/S*/ggZ#
    !!2Ng$3K)as8N&tjT#8]m/R@3k2b[ck03)j!>?4H'`\p6!!**(r[e6p.kWIZmJm:h!#kk:#.sp7ru_:B
    mJmV6jQ>U%kN:kH!!!)h!!!'!'`\gE'`eC:mf3^r!=pb8/ds9_.h;[J!!u[*s8GIerr6%#m/RGck3(kk
    kNM&%!Up'o!<<*)'bhDfrY5G=!Vufj!"K#0!#mOB.0(kM0,afj!V$-u!<A8^s6B[Es8S8_!U]poKBMCG
    !7'`iKECN@#RhF_'*&[\'b'X5r;[9-!$a!F*W[<7.jP)q!V-4#!<<,As8T>(W;lnB!!!&g!"63skFhmD
    jlEuS!!2Ng#S7^d%KHtR'bTm7!s/H(/-mj['`\n!/1Ukk!"985s8@'?Du]k7%KHP#!"8l0$KC71C'%l,
    jl$a?!!<6%!!3'6!X\o6rY5J8!!2Qh#Ri::0*_I`/1U`S%.4)q5Q:Zg2ukf6s8P=a!V$-t!]]?)jY?ff
    kN:qhmJmFp()7Pf!!N99!!Vcj$l1NL.KKPM/1iIi!!3'!o`,F%!dakFpBL[$pAb/A!Up's!H@5cf`qK\
    hWF!BmJmV%'GV;_!!*`J'FFm3!!WH(!?WpE,Q7ZH+tP;f!!2foq>^W-s8Tn6!!L"8s0r.!!">[bkcXsf
    !3>;FU]CPd!!<]G'bL?E!tZ.^&+9K$!\#`P)?'U>'eM$g!!2Zk!W`9$$g.KhLB.ATL&_2?"7Q9n!RU)n
    I/X*KGN@l9"Rc<t',;8j!!!$,'bhAP!!WQ+!"US5%fQG1%PKFQn,NUm!*fL'9)\en8,rO]!V-4"!rrBu
    jQ/].!WYOLl&b?6"9AcD'aFX;"9oSU%0>nt$NV(q!rr<%"YC_q"7Z@"!<<+Eq@Wc/!#,C9"9&;k!!E?)
    D;u0+!!<qtS-&0["T\T'$5EXA!!33:%da5t!<<]/!!3u<!V$-o!<<*#!FZ$-!!A;d!!2ipq#CKu!<?7$
    !!WK)KEM8T"RZ6i$2so,!<<Q0li77k!!30$!<</h!!!'!!!E<'!!!&c!"8o/!!*'#"98E'!WW;h!!!'!
    !!NB'!<<*#n,N[o!<<*#!!!'!!!!&f!!E<&!!*-"!!!'!!!**%o)K!s!!*-$!<<*#!!<-"!Wi?&l2Ueb
    rVup!q#Gp~>
    %%EndBinary
    %%EndObject
    Orginal image Size 553,9 KB
    After decoding the size is only 1,8 KB
    First try.
    public class ASCII85Decode {
    private ByteBuffer buf;
    * initialize the decoder with byte buffer in ASCII85 format
    private ASCII85Decode(ByteBuffer buf) {
    this.buf = buf;
    * get the next character from the input.
    * @return the next character, or -1 if at end of stream
    private int nextChar() {
    // skip whitespace
    // returns next character, or -1 if end of stream
    while (buf.remaining() > 0) {
    char c = (char) buf.get();
    if (!isWhiteSpace(c)) {
    return c;
    // EOF reached
    return -1;
    public static boolean isWhiteSpace(int c) {
    return (c == ' ' || c == '\t' || c == '\r' || c == '\n'
    || c == 0 || c == 12);
    // 0=nul, 12=ff
    * decode the next five ASCII85 characters into up to four decoded
    * bytes.  Return false when finished, or true otherwise.
    * @param baos the ByteArrayOutputStream to write output to, set to the
    *        correct position
    * @return false when finished, or true otherwise.
    private boolean decode5(ByteArrayOutputStream baos)
    throws PDFParseException {
    // stream ends in ~>
    int[] five = new int[5];
    int i;
    for (i = 0; i < 5; i++) {
    five[i] = nextChar();
    if (five[i] == '~') {
    if (nextChar() == '>') {
    break;
    } else {
    throw new PDFParseException(
    "Bad character in ASCII85Decode: not ~>");
    } else if (five[i] >= '!' && five[i] <= 'u') {
    five[i] -= '!';
    } else if (five[i] == 'z') {
    if (i == 0) {
    five[i] = 0;
    i = 4;
    } else {
    throw new PDFParseException(
    "Inappropriate 'z' in ASCII85Decode");
    } else {
    throw new PDFParseException(
    "Bad character in ASCII85Decode: " + five[i]
    + " (" + (char) five[i] + ")");
    if (i > 0) {
    i -= 1;
    int value = five[0] * 85 * 85 * 85 * 85 + five[1] * 85 * 85
    * 85 + five[2] * 85 * 85 + five[3] * 85 + five[4];
    for (int j = 0; j < i; j++) {
    int shift = 8 * (3 - j);
    baos.write((byte) ((value >> shift) & 0xff));
    return (i == 4);
    * decode the bytes
    * @return the decoded bytes
    private ByteBuffer decode() throws PDFParseException {
    // start from the beginning of the data
    buf.rewind();
    // allocate the output buffer
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    // decode the bytes
    while (decode5(baos)) {
    return ByteBuffer.wrap(baos.toByteArray());
    * decode an array of bytes in ASCII85 format.
    * <p>
    * In ASCII85 format, every 5 characters represents 4 decoded
    * bytes in base 85.  The entire stream can contain whitespace,
    * and ends in the characters '~&gt;'.
    * @param buf the encoded ASCII85 characters in a byte buffer
    * @param params parameters to the decoder (ignored)
    * @return the decoded bytes
    public static ByteBuffer decode(ByteBuffer buf)
    throws PDFParseException {
    ASCII85Decode me = new ASCII85Decode(buf);
    return me.decode();
    2. Try
    public class Ascii85Decode {
    private final FileOutputStream fos;
    private Ascii85Decode() throws FileNotFoundException {
    File f = new File("/home/markus/1/test/bild.jpg");
    fos = new FileOutputStream(f);
    @Override
    protected void finalize() throws Throwable {
    fos.close();
    super.finalize();
    public static byte[] decode(byte[] in) throws FileNotFoundException, IOException {
    Ascii85Decode ascii85Decode = new Ascii85Decode();
    ascii85Decode.setData(in);
    ascii85Decode.decode85();
    return null;
    static long pow85[] = {85 * 85 * 85 * 85, 85 * 85 * 85, 85 * 85, 85, 1};
    private byte[] in;
    private void setData(byte[] in) {
    this.in = in;
    void wput(long tuple, int bytes) throws IOException {
    switch (bytes) {
    case 4:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    putchar((int) (tuple >> 8));
    putchar((int) tuple);
    break;
    case 3:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    putchar((int) (tuple >> 8));
    break;
    case 2:
    putchar((int) (tuple >> 24));
    putchar((int) (tuple >> 16));
    break;
    case 1:
    putchar((int) (tuple >> 24));
    break;
    void decode85() throws IOException {
    long tuple = 0;
    int c, count = 0;
    int i=0;
    for (;;) {
    switch (c = in[i]) {
    default:
    if (c < '!' || c > 'u') {
    System.err.println("%s: bad character in ascii85 region: %#o\n");
    System.exit(1);
    tuple += (c - '!') * pow85[count++];
    if (count == 5) {
    wput(tuple, 4);
    count = 0;
    tuple = 0;
    break;
    case 'z':
    if (count != 0) {
    System.err.println("%s: z inside ascii85 5-tuple\n");
    System.exit(1);
    putchar(0);
    putchar(0);
    putchar(0);
    putchar(0);
    break;
    case '~':
    if (in[i+1] == '>') {
    if (count > 0) {
    count--;
    tuple += pow85[count];
    wput(tuple, count);
    c = in[i+1];
    return;
    System.err.println("%s: ~ without > in ascii85 section\n");
    System.exit(1);
    case '\n':
    case '\r':
    case '\t':
    case ' ':
    case '\0':
    case '\f':
    case '\b':
    case 0177:
    break;
    i++;
    private void putchar(int l) throws IOException {
    //System.out.write(l);
    fos.write(l);
    Does anybody have an idea to solve the problem?

    A scan from string function can be used as per the attachment. The double \ ('\\') is in the format string in order to interpret the '\' characters in your input string as literal characters and not special formatting.
    Message Edited by Dennis Knutson on 07-10-2006 03:53 PM
    Attachments:
    Scan From String.JPG ‏5 KB

  • Extract Image from SWF

    Is it possible to extract an image from your Flash
    application? For example, if I had a simple interactive logo
    designing SWF with a 'Save logo' button, could I implement some
    functionality to save the current logo (a section of the visible
    application) as an image file and store it on my server? How might
    I achieve this?
    Thanks in advance! Any help would be much appreciated.

    You could use BitmapData to get the bitmap information from
    the SWF. Then you could use Remoting of some sort (like amfphp) -
    which now supports ByteArrays. With this you could communicate to
    the server and save your bitmap data :) Or you could do it directly
    with posting as shown with example/source here:
    http://www.quasimondo.com/archives/000572.php

  • Problem with the RAW images from Canon 5d Mark III

    hope you are doing good. i need your opinion regarding a phenomena i am observing in the RAW images from Mark iii.
    The following images appear to be absolutely correct in the camera and when viewed through a picture viewer.
    I have tried and tested the following scenarios:
    1. Used a medium speed kingston CF Card (new) and transferred the images through the USB cable supplied with the camera.
    2. Thought the card might be slow OR faulty.. used Sandisk Extreme and Extreme Pro SD Cards but same result.
    3. Transferred SD Card data through the builit in laptop card reader.
    4. Have directly imported the images from SD Card into Lightroom 4.3, copied the data firstly to laptop HDD and then imported, copied the SD card data to an external HDD and then copied. .... same result!!
    5. Have tried the same with both Win7 and Mac OS.
    6. The DPP sw that came with the camera gives the error of 'Decoding Failed' with these images.
    Usually 10-15 images out of 100 give this kinda pattern. so i was hoping if you can guide me what is going wrong here !!!

    The camera and PictureViewer are likely showing you the embedded JPG, while DPP and LR are decoding the raw data which appears to be corrupted.  Assuming you have formatted your SD cards in the camera and the issues are always in the same positions in the same images when you transfer them multiple times from the card to different computers via different methods, then the data is on the card that way.
    If the embedded JPG is ok then the sensor is ok, so something between the sensor-readout and the storage on the card appears to be failing intermittently, and it’s time to talk to Canon, I think.

  • Extracting Images from PDF file

    Hello All,
                   I am reading PDF File.I need to extract images from PDF File programatically.But problem is that some images are stored inside PDF File using FlateDecode Filter and I need to first decode that file and then I can extract that image .I dont know the way to decode that image data.Is there any way or API to do that in C++.
    Thanks
    Aarti Nagpal

    I think you can do it through cos object in VC++ plugin..go through the PDEFilterSpec in
    Acrobat core api reference
    Be well..

  • How to download an image from java server

    Hi,
       I have created a program which allows me to upload images to Java Server thru Multipart.
    How can i receive an image from server and download it to iPhone app.Is there any way apart from NSURL i can download the image.
    Base64 Encoding & Decoding  seems to be not working.
    Thanks in advance,
      Haritha

    Hi,
       I have created a program which allows me to upload images to Java Server thru Multipart.
    How can i receive an image from server and download it to iPhone app.Is there any way apart from NSURL i can download the image.
    Base64 Encoding & Decoding  seems to be not working.
    Thanks in advance,
      Haritha

  • Resize images from table

    Hello!
    I had following problem.
    There is a code, which receives images from one table in RDBMS (images are stored in LONG RAW fields),
    reduces them and writes in other table. Here the code:
    OracleStatement stmt = (OracleStatement)con.createStatement();
    OracleResultSet rs = (OracleResultSet)stmt.executeQuery("SELECT image FROM bigimages WHERE IMGID=1");
    if (rs.next()) {
    InputStream in=rs.getBinaryStream(1);
    OutputStream out = new FileOutputStream("C:\\TMP.JPG");
    JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(in);
    JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(out);
    BufferedImage sourceImg=decoder.decodeAsBufferedImage();
    BufferedImage img=scaleToSize(nWidth, nHeight, sourceImg);
    encoder.encode(img);
    InputStream fStream = new FileInputStream("C:\\TMP.JPG");
    try {
    OraclePreparedStatement pstmt = (OraclePreparedStatement)con.prepareStatement("INSERT INTO smallimages VALUES (?,1)");
    pstmt.setBinaryStream(1,fStream,fStream.available());
    boolean result = pstmt.execute();
    pstmt.close();
    } catch (SQLException ex) {}
    in.close();
    out.close();
    backimageresize = true;
    rs.close();
    stmt.close();
    But for some reasons it is necessary to do without the temporary file.
    How it to make?

    You mean you want to do that without using a temporary file? If so, then use these two modified lines of code instead:
    OutputStream out = new ByteArrayOutputStream();
    InputStream fStream = new ByteArrayInputStream(out.toByteArray());

  • Resize images from DB

    Hello!
    I had following problem.
    There is a code, which receives images from one table in RDBMS (images are stored in LONG RAW fields),
    reduces them and writes in other table. Here the code:
    OracleStatement stmt = (OracleStatement)con.createStatement();
    OracleResultSet rs = (OracleResultSet)stmt.executeQuery("SELECT image FROM bigimages WHERE IMGID=1");
    if (rs.next()) {
    InputStream in=rs.getBinaryStream(1);
    OutputStream out = new FileOutputStream("C:\\TMP.JPG");
    JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(in);
    JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(out);
    BufferedImage sourceImg=decoder.decodeAsBufferedImage();
    BufferedImage img=scaleToSize(nWidth, nHeight, sourceImg);
    encoder.encode(img);
    InputStream fStream = new FileInputStream("C:\\TMP.JPG");
    try {
    OraclePreparedStatement pstmt = (OraclePreparedStatement)con.prepareStatement("INSERT INTO smallimages VALUES (?,1)");
    pstmt.setBinaryStream(1,fStream,fStream.available());
    boolean result = pstmt.execute();
    pstmt.close();
    } catch (SQLException ex) {}
    in.close();
    out.close();
    backimageresize = true;
    rs.close();
    stmt.close();
    But for some reasons it is necessary to do without the temporary file.
    How it to make?

    Already answered somewhere else. Please don't waste people's time by cross-posting.

  • IE 11, "unable to decode image at url" error

    we have many image file in a SharePoint 2013 image library, some jpg, are not displayed in IE, but it displays ok in Chrome and FF.
    when using F12 developer tool, we saw this "unable to decode image at url" , we are simply request a image at url. e.g
    https://abc.domain/abcsite/imagelibrary/abc.jpg

    Hi,
    some jpg files may have been renamed from a svg, gif or png extension. There are a number of differing JPEG formats.
    f12>Console tab, to view any error messages or blocked content or XSS error messages.
    f12>Networking tab, click the 'Start' button then refresh your page to see the page resource requests and response headers and content.
    f12>Emulation tab, documentModes of IE8 and lower do not natively support alpha channel image formats.
    Internet Options>Security tab, click "Reset all zones to default".... MSIE uses mime-sniffing.
    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to
    raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us
    Rob^_^

  • I am trying to import developed images from LightRoom 5 in o Photoshop 6.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, you do not have necessary access permissions or another progra

    I am trying to import developed images from LightRoom 5 Photoshop 6 for further editing.  I am receiving this message and the images will not open.....'Could not open scratch file because the file is locked, or you do not have necessary access permissions or another program is using the file.  Use the 'Properties' command in the Windows Explorer to unlock the file. How do I fix this?  I would greatly appreciate it if you would respond with terms and procedures that a computer ignorant user, such as me, will understand.   Thanks.

    Have you tried restoring the Preferences yet?

Maybe you are looking for

  • 11.1.2 opmn_EPM_epmsystem1 service will not start after server move

    Moved our 11.1.2 Windows 2008 SP2 (not R2) 64 bit machines from one domain to the other (test to prod) and reconfigured the repositories to the prod SQL server (2005). Configuration is all green yet the EPM_epmsystem1 will not go to started. It stick

  • Operating two Vis at same time

    First time posting here on NI, need some help with setting up a Labview program. A little background so you know what we are attempting to do and the level of skills involved in it. I'm a undergrad research assistant and I have never used labview bef

  • I can not save an email to file using XPS Writer. I'm using Windows 7 . Works fine with Internet Explorer?

    When I try to perform this function of saving an email to file using Windows 7 XPS Writer. I receive a message stating that Firefox is not responding. XPS Writer is working using Internet Explorer?

  • Price group

    Hello, I need to assign price group to all of my customers who currently don't have price group. How do i figure out which customers who don't have price group assigned to them. Is there any tabel from where I can fetch this information. Thank you in

  • FRM-92050 Error in connect into server

    Hi all I have question : I try To Deploy my oracle forms Over The internet I use for that Forms server 6i And when I try to Display the form from the browser It give me this Error : Frm-92050: failed to connect to the server. <servername:port> please