SQLite Images and Standalone Issues
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: SQLite Images and Standalone Issues
Glad you could solve your problem, but what exactly was the problem in the end?
Re: SQLite Images and Standalone Issues
I know, I know, 2 year old thread I actually came across it looking for information about pictures in sqlite dbs. Klaus, you've been waiting a long time for this answer, though, and I love it when I can pitch in for you!
Ormente came up with the answer, which was (pertinent parts in bold underline) -
Unfortunately for me, I have a tougher nut to crack, a picture that was encoded in a different programming environment that I can't get to decodeOrmente wrote: ↑Sat Aug 13, 2016 11:19 pm...
I gave a look at it, and i suspected the problem came from a lack of "metadata" about the cropped image stored in the DB. Somehow, the standalone could not figure out what to do with the retrieved data : If i saved the main image in the cropped field of the DB, it came back perfectly, but not the cropped one. This one was missing something, and that was not due to the writing/retrieving process since the other one go thru the same.
So, i gave a look at the doc and found that the "export snapshot" (on the CropIt button) can have a format specified, like AS JPEG. Simply adding this solved the issue for me. Give it a try.
For some mysterious reason the interactive livecode is more forgiving and try harder to figure out what to do with the data... but specifying a format seems to ensure the correct image header is included in the binary data, so LC know what it is when it get it back (ie how to decode it to a picture).
-
- Posts: 49
- Joined: Sat Nov 30, 2013 6:40 am
Re: SQLite Images and Standalone Issues
Try revOpenDatabase your SQLite with "binary" option:
revOpenDatabase("sqlite", "mydb.sqlite", "binary" )
revOpenDatabase("sqlite", "mydb.sqlite", "binary" )
Re: SQLite Images and Standalone Issues
Thank you for the suggestion Saman, The information being returned isn't raw binary though
The problem with the pictures is a couple fold.
I'd most likely have to do that anyway, even if I found a way to decode it in this language, since I sure wouldn't want to have to deal with this problem further down the line all over again
** Picture showing the first several lines of the returned data of one picture - The returned information is a LOT larger than Lc's returned information for the same picture base64 encoded, about 2.6 times larger. Lc pic encoded = 80kb, encoded picture being retrieved from the db = 207+kb.
Just in case someone wanted to see what I'm pulling I've attached this picture, pulled from the db and put into a text file.
The problem with the pictures is a couple fold.
- The language I was using at the time I wrote this program in didn't have an easy way to translate pictures to text, so one of our fellow's came up with a brilliant (but complicated) way to do it. However, it worked so a lot of us used it without understanding the full implications of it, a mistake I have managed to avoid since
- It encoded to base 64, but it did a lot of manipulations, line by line and column by column of the picture, maybe even dot by dot, then did the encode. I really haven't finished going through the entire code yet, it was quite a bit.
- It also looks like he broke each channel (rgb) down separately, along with (in that language) the rgbsurface mask. Fun fun
I'd most likely have to do that anyway, even if I found a way to decode it in this language, since I sure wouldn't want to have to deal with this problem further down the line all over again
** Picture showing the first several lines of the returned data of one picture - The returned information is a LOT larger than Lc's returned information for the same picture base64 encoded, about 2.6 times larger. Lc pic encoded = 80kb, encoded picture being retrieved from the db = 207+kb.
Just in case someone wanted to see what I'm pulling I've attached this picture, pulled from the db and put into a text file.
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: SQLite Images and Standalone Issues
If the images are all video related thumbnails then perhaps it would be easier to pull them from the web rather than try to decipher another’s algorithm.
Re: SQLite Images and Standalone Issues
What fun is that
Just kidding, although I do like the small challenges this problem presents.
Of course, the resolution isn't as easy as just sucking the images off the imdb or the like, as it isn't just movie thumbs in this program. There are also other household items involved, many so old they are difficult to locate. The program was conceived by my wife, to keep track of everything we own. The original version has been (and still is) chugging away for over 10 years now.
Even if I could find and tap into all of them online, I would eschew relying on it, I've seen too many things disappear from the world wide time waster. Heck, even in Lc, a lot of the older information is gone that was linked in the resources. Storing locally would be the only way I know to offset that kind of (potential) loss.
Just kidding, although I do like the small challenges this problem presents.
Of course, the resolution isn't as easy as just sucking the images off the imdb or the like, as it isn't just movie thumbs in this program. There are also other household items involved, many so old they are difficult to locate. The program was conceived by my wife, to keep track of everything we own. The original version has been (and still is) chugging away for over 10 years now.
Even if I could find and tap into all of them online, I would eschew relying on it, I've seen too many things disappear from the world wide time waster. Heck, even in Lc, a lot of the older information is gone that was linked in the resources. Storing locally would be the only way I know to offset that kind of (potential) loss.
-
- VIP Livecode Opensource Backer
- Posts: 474
- Joined: Thu Sep 04, 2008 6:23 am
- Location: Melbourne Australia
Re: SQLite Images and Standalone Issues
Re the movie thumbs etc - I meant to download new ones to repopulate your new dB.
But as you have stated there are other images of things that may not be on the web, then decoding that blasted bit of clever but obtuse encoding seems the way to go.
But as you have stated there are other images of things that may not be on the web, then decoding that blasted bit of clever but obtuse encoding seems the way to go.
Re: SQLite Images and Standalone Issues
Well, that or like I said earlier, using that same language and bit of code to auto extract/name/save all the images to a folder, and then switching back to Lc to do the same in reverse. It is just an interesting puzzle to me at the moment, if I become too bored with it, I'll resort to method 2 in a flash
Re: SQLite Images and Standalone Issues
Do you know the dimensions of the extracted picture? It looks like the data is probably ok but needs to be placed into an image that has its size correctly set BEFORE inserting the data.
Re: SQLite Images and Standalone Issues
Actually I do, and I tried that, but , well, heh see for yourself.
The data of the picture itself is certainly still ok, as when I use the program I made it reads it in and out ok.
In the previous language, no matter the size of the container, it always put the image into it clearly, which makes me think I'm still missing a ...key to the formula. I'll be going over my notes one more time on the previous work.
The data of the picture itself is certainly still ok, as when I use the program I made it reads it in and out ok.
In the previous language, no matter the size of the container, it always put the image into it clearly, which makes me think I'm still missing a ...key to the formula. I'll be going over my notes one more time on the previous work.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SQLite Images and Standalone Issues
Sparkout is right, this is what happens if there is even a single pixel difference in the size of the target image. Create an empty image object with the correct dimensions, then import the image, and then scale it afterward if you want.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SQLite Images and Standalone Issues
In the above screen shot, that was exactly what I did, the image container was 'empty', it was set to the dimension of the picture as it was put into the db. Now, I have no doubt that what Sparkout and you are saying is very true, but that makes me pretty sad, since a lot of the pictures are not of the same dimensions.
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SQLite Images and Standalone Issues
Can you use an image editor to save them in a more standard format? Then import those?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SQLite Images and Standalone Issues
Here the solution, I wrote it in 2015 and I forgot it: https://livecodeitalia.blogspot.it/2015 ... se_46.html
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w