Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / fast loading of images ... ??

Author
Message
Furord
9
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 28th Aug 2018 12:50
I was wondering if there is any way to load the images with lower quality but faster, there is a command to load them with lower quality (LoadImageResized) but it takes the same, I need them to load fast since it is for photo thumbnails. It is for a project that uploads mobile phone photos and uploads them to a server. With Wasab photos there is no problem, but with the ones made by the device it is very slow. A greeting and sorry for my English of the translator of google xD.

Me preguntaba si existe alguna forma de cargar las imagenes con menor calidad pero mas rapido, hay un comando para cargarlas con menor calidad (LoadImageResized) pero tarda lo mismo, yo necesito que se cargen rapido puesto que es para miniaturas de fotos. Es para un proyecto que carga las fotos de telefono movil y las sube a un servidor. con fotos de Wasab no hay problema, pero con las hechas por el dispositivo va muy lento. Un saludo y perdon por mi ingles del traductor de google xD.
Bengismo
6
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 28th Aug 2018 15:51
For you to load an image from a file as a smaller version you still have to open the whole file and read the whole file. To get a smaller version arguably takes longer as you have to do all this then resize it to be smaller on top of loading the whole thing.

A better option is to save thumbnail images as separate files and load those instead. (See ResizeImage and SaveImage()). These can be a fraction of the size and so can load much quicker.

A few people on here have shown that loading a previously saved memblock image is quick and so for each of your images you could do that too. There's a thread on here about it somewhere.

-Convert the image to a small thumbnail sized version (ResizeImage())
-Convert this to a memblock (CreateImageFromMemblock())
-Save the memblock as a file (perhaps named xxxxxx.thm or something) (CreateFileFromMemblock())

Then when you want to load the thumbnail, you load the file into a memblock (CreateMemblockFromFile()) then make an image from it (CreateImageFromMemblock).



Furord
9
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 28th Aug 2018 17:43
Thanks for the help, but generating thumbnails is not what I want, I do not want the program to save data. I do not remember if it was in (darkbasic) in (fenix) or in (div) but if I remember that when loading the image you had the intention of loading it with lower quality in a kind of fast loading, there is also the occion in (C ++) if I am not mistaken.


Gracias por la ayuda, pero generar miniaturas no es lo que quiero, no quiero que el programa guarde datos. no me acuerdo si era en (darkbasic) en (fenix) o en (div) pero si recuerdo que al cargar la imagen tenias la occion de cargarla con menor calidad en una especie de carga rapida, tambien esta la occion en (C++) si no me equivoco.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Aug 2018 17:48
Yes you're much better off creating thumbnails outside the program.

Alternatively, you can have the server handle the thumbnail creation automatically when an image is uploaded, which is probably what I'd do. That would minimize the bandwidth needed by the mobile device since you'd be uploading only the original image and not an additional thumbnail.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Jerry McGuire
7
Years of Service
User Offline
Joined: 25th Mar 2017
Location:
Posted: 28th Aug 2018 17:51 Edited at: 28th Aug 2018 17:52
What (I believe) Bengismo is trying to say, and what I actually do sometimes, is to "build" a helper program that saves the image as a memblock-file. Then you put this file in the media directory of your actual program and call it using the memblock commands.
In other words, you need two different programs. One to put the images in this "quick format", the other (your actual app) which will load the images in "quick format". Hope that clarifies.
iMac Book Pro, MacOS 10.12.4, Xcode 9.0.1;
iPhone 6, iOS 9.35; iPhone 5s, iOS 9.35; iPad (3rd gen), iOS 9.35;

Dell Precision T7400, Windows 7 Professional 64bit, Visual Studio Community 2017;
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 28th Aug 2018 23:16
Are you not thinking of progressive jpegs and such, where you can load only the lowest detail level? If so, I don't think there's a way to do it in agk or at least not tier 1.

As Bengisimo said, memblocks load faster but are larger and useless outside the program.
Furord
9
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 29th Aug 2018 12:46
Thank you all. Jerry McGuire, I forgot to say that the program is for android and either I'm wrong or you can not put a program in the background.
Santman, I think that's exactly that.
Anyway now I'm having problems with the "val" command, I did not know that I had such a low limit to translate strings.


Gracias a todos. Jerry McGuire, se me olvido decir que el programa es para android y o me equivoco o no se puede poner un programa en segundo plano.
Santman, creo que es exactamente eso.
De todos modos ahora me esta dando problemas el comando "val" no sabia que tenia un limite tan bajo para traducir cadenas.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Aug 2018 14:04
Val is limited to 4 bytes because it returns an integer. How big of a number are you trying to cast?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 30th Aug 2018 06:40
Quote: "I was wondering if there is any way to load the images with lower quality"

you would need to read the binary data and using a read command that allows for an offset you could grab perhaps every
second pixel or 4th pixel etc Im not so sure how well this would speed things up and you still would need to transform that data
into a memblock and then convert to an image. It certainly would be allot better to have the thumbnails presaved and there
quality would be much better if you sized them in a paint program as they use allot better algorythm than im suggesting. If
you have very large pics they are probably not that suitable for html or mobile so that is something else you could look at
fubar
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 30th Aug 2018 08:08
I don't think you could do that with a compressed image tho8gh. A JPEG for example isn't storing pixel data, so stepped binary data wouldn't work, it wouldn't decompress.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 30th Aug 2018 10:16 Edited at: 30th Aug 2018 10:19
You could do it in some way with JPEGs as well.

They have 8x8 rasters. A completly Black image also has these rasters. But I guess, you would nearly "write" your own decoder. There could be also stored thumbnails in the JPEG. Thats how photocameras do it. Its a JPEG stored in the META-Data of the JPEG. So you don't need to create thumbnails, because they maybe allready there.
So you would only have to trunc the META-Data maybe into a seperate temp-file and load that with LoadImage()

e.g.
https://www.sno.phy.queensu.ca/~phil/exiftool/
Quote: "Extracts thumbnail images, preview images, and large JPEG images from RAW files"


More infos about extracting JPEG-thumbnails on StackOverflow (I used a searchengine)
https://stackoverflow.com/questions/10349622/extract-thumbnail-from-jpeg-file
Furord
9
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 3rd Sep 2018 19:54 Edited at: 4th Sep 2018 11:12
Thanks for the advice, for now I will continue as I go even if it is a bit slow. I pass a download link in case someone wants to try it, it is not finished, but to know what you think, a greeting.
http://www.orlanime.es/145/kiosco/

Gracias por los consejos, de momento voy a seguir como voy aunque sea un poco lento. Os paso un enlace de descarga por si alguien quiere probarlo, no esta acabado, pero para saber que os parece, un saludo.
http://www.orlanime.es/145/kiosco/
Furord
9
Years of Service
User Offline
Joined: 8th Aug 2014
Location:
Posted: 4th Sep 2018 11:17
It is a very premature version of what I want to be an online development kiosk, at the moment it only scans the terminal and lets you select the photos in your folders, a little more, a greeting.
http://www.orlanime.es/145/kiosco/

Es una versiĆ³n muy prematura de lo que quiero que sea un kiosco de revelado online, de momento solo escanea el terminal y te deja selecionar las fotos en sus carpetas, poco mas, un saludo.
http://www.orlanime.es/145/kiosco/

Login to post a reply

Server time is: 2024-04-25 06:05:36
Your offset time is: 2024-04-25 06:05:36