How do I convert a JPEG picture to a binary image? I need to insert it into a blob column in a database. Ultimately I am trying to put a logo jpeg image on a report header. I thought I could simply put a ReportPicture control box on the report and select an embedded image from image dropdown menu in the Behavior dialog box. But when I try that, the image does not show up on the report when printed. What is that Image drop down box on the behavior dialogue for?
@Dan Schwartz Conversion is always automatic in Xojo.
Once you have declared a column as a Blob column in SQLiteDatabase, you can use the DatabaseRecord.PictureColumn to add a picture. Conversion is automatic.
RecordSet allows you to retrieve data. It has a generic method named Field which itself has a PictureValue property which you can use to retrieve a Picture.
Thank you very much Stephane! This solved my problem.
I have a similar issue, I am trying to create a report with a logo image in the header, but when I add the image from a JPG or PNG file, it never shows in the ReportPicture control box. Is this not the correct way to add a picture? Is the format of the picture relevant?
I am not using SQLite, but SQLServer. The image only appears once in the header, so setting up a database column for this is overkill.
@Japp Hoetmer AFAIK about ReportPicture, you can also set a static image from an image or file.
In the Inspector, select an image from the Image popup menu or select “browse ” from that menu to select a file on disk to be included into your project.
Thanks, Stphane, but that simply doesn’t work, and is also the reason I ask the question. The ReportPicture stays blank. I tried with Jpeg and Png files, and nothing shows.
@Jaap Hoetmer Then you should probably file a bug report.
Not having a good understanding of the printing and reporting features in Xojo, I started to read more about it in the forums and elsewhere, and I get the feeling this is an as-yet underdeveloped part in Xojo. The application I want to create relies on good printing features, multiple printers for reports, labels and other output types, and printer options, and I don’t see that Xojo is able to deliver this. The report writer is clumsy, and the problems with the image as mentioned above give it a buggy feel.
Maybe I should file a bug report, but reading some of the other forum comments I understand printing is in big demand, lots of people are having similar issues, so it is clearly a generic problem in Xojo and needs to be reworked.
This for me is a showstopper, unfortunately, I will have to put Xojo development aside until this part matures.
Thanks Stphane for the replies.