Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User 0x03d0's Avatar
    Join Date
    Jul 2008
    Posts
    2
    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 marko_m's Avatar
    Join Date
    Feb 2008
    Posts
    5
    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 ltomuta's Avatar
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,335
    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.

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. Theme Studio 3.1 not creating themes
    By zemm in forum Themes/Carbide.ui
    Replies: 11
    Last Post: 2008-10-18, 08:41
  3. Replies: 3
    Last Post: 2008-01-28, 14:00
  4. Error Loading Images Nokia 7210!!!
    By mrai in forum Mobile Java General
    Replies: 2
    Last Post: 2003-04-24, 17:52
  5. 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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved