×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    2

    Loading Large Images

    Hi,

    I was wondering if there was a limit to the size of an image that can be loaded using QPixmap.
    The following code does not seem load images that are more than ~200KB in size.

    Code:
    void MainWindow::paintEvent(QPaintEvent* aEvent)
    {
    	QPixmap pic;
    	bool loaded = pic.load("E:\\SImages\\1.jpg");
    	QPainter painter(this);
    	if( loaded )
    	{
    		painter.drawPixmap(0,0,width(),height(),pic,0,0,pic.width(),pic.height());
    	}
    	else
    	{
                    // draw diagonal line if load fails
    		painter.drawLine(0,0,width(),height());
    	}
    }
    The above code seems to work just fine when compiled for windows!
    It can handle images of any size.

    But on my phone (Nokia 5800),it can successfully load images only upto 200KB.
    If the image is more than 200KB, the load fails and a diagonal line is drawn.
    So, how exactly do I load large images?

    Thanks,

  2. #2
    Registered User
    Join Date
    Feb 2008
    Posts
    5

    Re: Loading Large Images

    Hi,

    You could try to increase heap size to see if default heap
    size is not enough for loading large images.

    Heap size can be controlled using following lines
    in .pro file:

    symbian: {
    TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // Min 128kb, Max 16Mb
    }

  3. #3
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Loading Large Images

    A phone does not have the kind of memory resources you are used to seeing on a mobile so although the code is portable you will still have to think "mobile" when designing the mobile version of your application and optimize it accordingly. When the use case allows you might want to create some thumbnails and operate with them rather than the full image.
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

Similar Threads

  1. Memory leak when unloading and loading images
    By jheanley in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2009-04-09, 16:00
  2. Replies: 3
    Last Post: 2008-01-28, 14:00
  3. Error Loading Images Nokia 7210!!!
    By mrai in forum Mobile Java General
    Replies: 2
    Last Post: 2003-04-24, 17:52
  4. Loading images - bug or no bug ?
    By mcmcdonald in forum Mobile Java General
    Replies: 2
    Last Post: 2003-04-22, 09:05

Posting Permissions

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