[SOLVED] I have a problem displaying an image from Clipboard

Author: eitan@amital.co.il (hareitan)

Hi. I have a DUMMY field, widget type = Picture, Data type = Image (any source) (also tried Data type = raw data). I'm trying to paste an image clipboard data from PrintScreen to the field, but keep getting a "FORMAT" image error. If I paste first into any graphic tool (e.g. MSPaint, IrfanView etc.) and Copy it again - it's pastes correctly. I've noticed a difference between the raw data. When pasting dircetly from the clipboard (after Print Screen), the data looks like: "#BM{lq{&{!{!{!{!{!6{!{!{!({!{!{!W{"{!{!{%{"{!{!{"{! {!{${!{!{!pq{&{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!|q{!{!|q{!{!|q{!{!{!{P|N|e|q{P|N|e|q{P|N|e|q{P|N|e|q{P|N|e|q{P|N|e|q{P|N|e|q|d|V|I|q|d|V|I|q|d|V|I|q|d|V|I|q|d|V|I|q|d|V|I|q|e|^|[|qLLL|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b|q|b|b|b| and when pasting from MSPaint it looks like: "#BMV{9{%{!{!{!{!{!6{!{!{!({!{!{!W{"{!{!{%{"{!{!{"{!{9{!{!{!{!{! {9{%{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{!{P|N|e{P|N|e{P|N|e{P|N|e{P|N|e{P|N|e{P|N|e|d|V|I|d|V|I|d|V|I|d|V|I|d|V|I|d|V|I|e|^|[LLL|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|b|   Can anyone help?   Thanks   Eitan

7 Comments

  1. Hi Eitan, It seems that the Windows PrintScreen functionality is using some proprietary format that is not supported by Uniface. Have you already tried using a screen capture tool instead? I did a quick test using a tool called FastStone Capture and with it I can paste screen captures without any problem into a Uniface Picture field. Hope this helps. Daniel


    Author: diseli (daniel.iseli@uniface.com)
  2. Thanks, but I want something users can do w/o having to install anything.


    Author: hareitan (eitan@amital.co.il)
  3. Hi Eitan, I can only confirm you the printscreen is a generating a different image format, not directly managed from Uniface. To directly manage it in Uniface you need to add to your configuration an image filter like the one still available for WMF from old times. A very nice program to do batch conversions is "Irfan Viewer". It converts from format to format easily from command line; the convert action could also be applied to all images in a specific directory having as destination another specific directory. Converting clipboard PrintScreen to JPG is as simple as: i_view32.exe /clippaste /convert=myImg.jpg /killmesoftly Another image manipulation program with very powerful command line options is ImageMagick. Hope it helps you... :-) Gianni


    Author: gianni (gianni.sandigliano@unifacesolutions.com)
  4. Hi Eitan, I think that I might have found a workaround for this: when you paste an image from the Windows clipboard to a HTML field then you can copy it from there to a Picture field using some JavaScript code. I've found the following JavaScript sample code that does the part to copy the image from the Clipboard and convert it to a PNG image in Base64 format: http://jsfiddle.net/bt7BU/225/ I've also create a small sample form that demonstrates the complete process (see "Copy image from Windows Clipboard to Picture field" in the Community Samples). Hope this helps. Daniel


    Author: diseli (daniel.iseli@uniface.com)
  5. gianni said Hi Eitan, I can only confirm you the printscreen is a generating a different image format, not directly managed from Uniface. To directly manage it in Uniface you need to add to your configuration an image filter like the one still available for WMF from old times. A very nice program to do batch conversions is "Irfan Viewer". It converts from format to format easily from command line; the convert action could also be applied to all images in a specific directory having as destination another specific directory. Converting clipboard PrintScreen to JPG is as simple as: i_view32.exe /clippaste /convert=myImg.jpg /killmesoftly Another image manipulation program with very powerful command line options is ImageMagick. Hope it helps you... :-) Gianni

    Thanks, but as I've mentioned before, I cannot use a 3rd party utility.


    Author: hareitan (eitan@amital.co.il)
  6. diseli said Hi Eitan, I think that I might have found a workaround for this: when you paste an image from the Windows clipboard to a HTML field then you can copy it from there to a Picture field using some JavaScript code. I've found the following JavaScript sample code that does the part to copy the image from the Clipboard and convert it to a PNG image in Base64 format: http://jsfiddle.net/bt7BU/225/ I've also create a small sample form that demonstrates the complete process (see "Copy image from Windows Clipboard to Picture field" in the Community Samples). Hope this helps. Daniel

    Works great!   Thank you very much!   Eitan


    Author: hareitan (eitan@amital.co.il)
  7. hareitan said Works great!   Thank you very much!   Eitan

    You are welcome. Smile Daniel


    Author: diseli (daniel.iseli@uniface.com)