Results 1 to 7 of 7

Thread: Aborting the loading of a jpeg?

  1. #1

    Aborting the loading of a jpeg?

    I am currently making a simple photo viewer called "Armchair Foto Viewer". I usually use ACDSEE to view pictures but when I showing people photos on my plasma TV I find that many images are rotated. ACDSEE does not have a simple way to rotate the displayed image.

    Hence I have made a photo viewer that can be completely controled by wireless mouse and does the things I want.

    Now my question...

    In acdsee you can see the application begin to load a jpeg, if you then use the mouse wheel to go to the next of previous image ACDSEE abandons the loading process and begins to load the next file.

    How do they do this?

    I am caching photos ahead of time so when viewing at a normal speed it is very quick.

    However, if you want to quickly skip a few photos ahead or back the process is paused as each entire photo is loaded and then discarded. This is noticeable especially when the resolution and hence the file size gets quite big.

    I would like to know is there are a freeware routine that includes the ability to abort the loading process? I figure some call back would be required.

    Anyone got any ideas?
    The views expressed on this programme are bloody good ones. - Fred Dagg

  2. #2

    Aborting the loading of a jpeg?

    Well, I don't know how to cancel (unless you write your own loading code, witch is what ACDC does), but I do have a suggestion. In our photography application that we give to everyone we do shoots for (did I mention we have a studio on top of all of my other skills) we check the CRW and Exif blocks of the images for rotation. This is an easy flag to find, and is typically 1, 2, 3, 4 or 0, 90, 180, 270. So matching this up you can autorotate

    Personllay, I went with custom loading code, but I'm not willing (able) to give it away. I kinda lost the source , next time I need an update I'll have to re-invent the wheel. Luckily until I upgrade my cameras I don't have to worry about an update

  3. #3

    Aborting the loading of a jpeg?

    I doubt I will bother to make loading code.

    As for the suggestion about rotating. I am not sure how that works. If the image is snapped in portrait mode on the camera the image is still stored in landscape mode (atleast with my aging sony). So when you come to view the image it is lying on it's side.

    I was going to store all files that the user rotates while viewing. If that image is viewed subsequently it will be auto rotated.

    The basic application is almost done. Quite happy with the graphical user interface.
    The views expressed on this programme are bloody good ones. - Fred Dagg

  4. #4

    Aborting the loading of a jpeg?

    I don’t know what lib you’re using for the loading, but maybe you can find something that its not blocking (give it a pointer to the buffer and a pointer to a ‘progress-event-procedure’)?

    Don’t know if it will work for your application, but you can try and preload images using threads.
    [size=9px]BEGIN GEEK CODE BLOCK
    <br />d s-- : a24 GB GCS GTW GE C++ P L+ W++ N+ K- w++++ M- PS+ PE+ Y- t+ 5+++ X+ R*
    <br />tv b+ DI++ D+ e++ h+ G-
    <br />END GEEK CODE BLOCK[/size]
    <br />Create your own GeekCode block at: <a href="">...</a>

  5. #5

    Aborting the loading of a jpeg?

    Quote Originally Posted by czar
    I doubt I will bother to make loading code.

    As for the suggestion about rotating. I am not sure how that works. If the image is snapped in portrait mode on the camera the image is still stored in landscape mode (atleast with my aging sony). So when you come to view the image it is lying on it's side.

    I was going to store all files that the user rotates while viewing. If that image is viewed subsequently it will be auto rotated.

    The basic application is almost done. Quite happy with the graphical user interface.
    You are correct, and even on your old Sony it has an Exif block. Look at the Exif block with Delphi Exif. You will see a Rotation or Orientation meta segment. Look at the value, that value tells you how to rotate your image. I'll see if I can't find some code that shows you what I mean. Your app still has to handle the rotation, so the origional isn't destroied. And with the crappy version of JPEG that Sony has used for years, the modification (outside of a good photo app like PS) can quickly degrade the quality.

  6. #6

    Aborting the loading of a jpeg?

    czar - see if the sample at: http://www.eonclash.com/samples/Viewer.zip or http://www.eonclash.com/samples/Viewer.7z helps you out at all. It does the autorotation w/o modifying the origional image file and also scales the image (with the crappy stretchdraw function).

  7. #7

    Aborting the loading of a jpeg?

    Hi jdarling,

    First off thansk for positing the example.

    By the way the viewer.zip is broken - it is missing some bytes. I downloaded the other acrhive however.

    I have added the auto rotate code to my viewer and with your pictures it works a treat. My sony camera does not appear to store rotation information. Oh well, at least it will do it for those files that contain the orientation information.

    The main application is now complete just adding on other features that I want.

    My AFV viewer uses DirectX 9 to display and rotate etc. I will post it here if people want to have a look at it.
    The views expressed on this programme are bloody good ones. - Fred Dagg

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •