Results 1 to 2 of 2
Like Tree2Likes
  • 2 Post By Maridius
  1.    #1  
    Hello everyone! I am releasing an image viewer app written entirely in C that allows you to view high resolution images of up to 12288x12288 on the Pre2, and 16384x16384 on the Pre3 and Touchpad (when using texture compression).

    Features:
    • Image panning, two finger zoom, double-tap zoom with two zoom levels.
    • Image rotates based on device orientation.
    • Images may be switched either by swiping from left to right (or right to left), or by using the gesture bar. Application is minimized by tapping the center of the gesture bar.
    • The gesture bar may be used to switch an image while it is loading.
    • Images are sorted in alphabetical order.
    • When the app launches it displays the last image viewed, if present, otherwise the first image in the image directory (alphabetically sorted) is loaded.
    • Images to be displayed need to be placed in the directory: /media/internal/HighResViewer/
    • The application log file can be found at: /media/internal/HighResViewer/log and is truncated when the application launches.
    • Image continues loading when app is minimized.


    Supported devices:
    HighRes Viewer will run on the Pre(+), Pre2, Pre3 and Touchpad. Currently the Pixi is not supported, although if there is a large enough demand I will look into this a bit more. I have not yet tested with the Pixi+ and the Veer, so any data on them is welcomed .

    Supported formats:
    Image: JPG, PNG, GIF, BMP, LBM, PCX, PNM, TGA, TIF, XCF, XPM
    Texture: ETC1, PVR, ATITC

    Installation:
    1. Install HighRes Viewer from the attached IPK
    2. Create a directory named 'HighResViewer' in /media/internal/ and place in it the images you would like to view. If you used the attached script to convert an image into texture files, copy the entire directory created by the script.
    3. Launch the app.

    To add more images, simply copy them into /media/internal/HighResViewer and relaunch the app.

    Background:
    The motivation for this project came from the well known issue regarding how webOS displays large images: blurry and with poor zoom capability. According to this post the reason for such poor performance is due to the fact that most applications (including the default Photo App) use WebKit for image rendering. The installation of WebKit used by webOS comes with hardcoded limits that govern the maximum size of rendered images, as well as how far you can zoom. webOS 3.x had this limit increased but not sufficiently enough to view large, 8192^2+ images. So why is this app different?

    How It Works:
    HighRes Viewer uses the SDL and OpenGL libraries to display images, completely bypassing WebKit. Given a .png file the app loads the uncompressed file into memory using SDL, cuts it up into 2048x2048 tiles and converts each tile into an OpenGL texture which it then displays. I use 2048^2 size textures since that is the maximum texture size supported by the Pre/Pre2's PowerVR SGX530 GPU (all other webOS devices support 4096^2). The problem with this approach is that a large 8192x 8192 image will consume 192MB when its uncompressed (assuming an RGB format), and that's a lot of memory! In order to avoid disk I/O the entire image needs to be stored in RAM/swap, which means the larger the image the less memory there is for other applications, including webOS services like Luna. If the app tries to load an image that is too large, webOS will kill it or the application will encounter an OpenGL out of memory error and exit on its own. See the table below for an idea of how much image data each webOS device can load before HighRes Viewer terminates:

    Code:
    Device:		GPU:				Aprox. Memory available to OpenGL (MB)	# Tiles (compressed)
    Pre(+)		PowerVR SGX530		85								31 (Pre)
    Pre2			PowerVR SGX530		109								40
    Pre3			Qualcomm Adreno 205	200								75 tiles (webOS crashed before OpenGL error)
    Pixi(+)		Qualcomm Adreno 200	???								???
    Touchpad		Qualcomm Adreno 220	202								76 tiles
    Veer			Qualcomm Adreno 205	???								???
    So, instead of only being able to load images in formats that need to be decompressed (eg. png), HighRes Viewer can also load compressed texture files, allowing us to load ~5 times as much image data in the same RAM footprint. This means that our 8192^2 image can now be loaded onto only 39MB of RAM, or 44MB with mipmaps. There are three methods of texture compression available to webOS devices: ETC1, PVR and ATITC. ETC1 is supported by all webOS devices, PVR is supported by the Pre(+)/Pre2 and ATITC is supported by the Pixi(+), Pre3, Touchpad and Veer. I have attached a bash script (compress_image.sh) I wrote that converts an image (jpeg, png etc.) into one of these three texture formats and places the converted files in a folder of your choice. To view the compressed image just copy the created folder to /media/internal/HighResViewer and relaunch the app.

    All images are anti-aliased and have trilinear filtering applied to them. This means that for regular images the application generates mipmaps before rendering, and images stored in one of the three texture compression formats already contain pregenerated mipmaps.

    Please note that the ETC1 compression tool the script uses is (as of February 2015) no longer available. I have attached the Linux-64-bit binary here; alternatively you may modify the script to use a tool of your choice.

    Also note that due to restrictions on the types of files I can upload, all attachments have a dummy file extension (txt, jar). Remove it, set execute permissions if needed and you are set.

    Known Issues:

    When launching the app you may see a black screen for a few seconds while the first image is loading.

    When loading images on the Pre3 the back/forward gestures may not switch the image, instead the user must wait until the image is fully loaded before these gestures are recognized.

    Another issue with the Pre3 occurs when an image loads while the application is minimized. If the image finished loading while the app was minimized, some tiles may not be visible. Touch the screen and they will appear.

    When you minimize the app on the Touchpad the last tile loaded disappears. It appears once the app is maximized.

    If you are still running an OTA 1.4.5 version of webOS the application log is in the application's directory due to the app not being given write permissions on /media/internal by the jailer.

    Please report any other bugs in this thread, along with the relevant log messages. But before you do, make sure that you are using a texture compression algorithm supported by your device, and that the image you are loading is not too large.

    Tips:
    One way to get very high resolution images of city or subway maps is to find the map in PDF form, import it into GIMP or Photoshop and save it as a png with 500+ pixels per inch.

    Version History:

    March 22, 2015
    1.0.0 (initial release)

    Licensing:
    The application is currently closed source.


    I hope that many of you will find this app useful . I use it to view subway maps in the states and tourist maps abroad.
    Attached Files Attached Files
    Last edited by Maridius; 06/10/2015 at 10:48 PM. Reason: Fixed ATITC handling in compress.sh
    Preemptive and mazzinia like this.
  2. #2  
    <thread moved>

    @OP... we're working on getting your account access to this forum. Sorry for the wait! Hopefully you should have access now

Similar Threads

  1. Collection of HighRes Icons?
    By Sonic-NKT in forum HP Pre 3
    Replies: 3
    Last Post: 08/08/2012, 06:46 PM
  2. Re: PDF Viewer
    By Vanhalla1 in forum Palm Pre and Pre Plus
    Replies: 5
    Last Post: 03/12/2010, 08:35 AM
  3. Does WX have fax viewer?
    By scsanden in forum Palm Windows Mobile Devices & Apps
    Replies: 1
    Last Post: 01/27/2007, 09:21 PM
  4. Newbie.... looking for MS Word viewer/editors and a html viewer.
    By calyth#WN in forum Palm OS Devices & Apps
    Replies: 5
    Last Post: 09/23/2002, 11:10 AM
  5. Jpg Viewer?
    By ashmed in forum Palm OS Devices & Apps
    Replies: 0
    Last Post: 03/02/2001, 03:42 PM

Tags for this Thread

Posting Permissions