FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting the width, size and length of an image

 
Post new topic   Reply to topic     Forum Index -> DFL
View previous topic :: View next topic  
Author Message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Sat Nov 08, 2008 1:37 pm    Post subject: Getting the width, size and length of an image Reply with quote

Greetings!

I am trying to find the height and width of an image with this little program,
Code:
import std.stdio;
import std.string;
import dfl.all;

void main() {
        auto picture = new PictureBox;
        picture.image = new Picture("psipmain.JPG");
        writefln("width  = " ~ std.string.toString(picture.image.width));
        writefln("height = " ~ std.string.toString(picture.image.height));
        //picture.dispose();
}


I see the dispose() function there and I am wondering how is it use? I am opening thousands of pictures and all I am doing is just getting their size and then creating an HTML report on the whole directory structure. When do I use dispose to clean the memory? Or is this even what this function is for?

thanks,

jose
Back to top
View user's profile Send private message
Chris Miller



Joined: 27 Mar 2004
Posts: 514
Location: The Internet

PostPosted: Mon Nov 10, 2008 4:04 pm    Post subject: Re: Getting the width, size and length of an image Reply with quote

The dispose method releases the internal image resources. You can call it when you're done with a Picture instance.
Back to top
View user's profile Send private message
jicman



Joined: 22 Dec 2004
Posts: 298
Location: Rochester, NY

PostPosted: Mon Nov 10, 2008 6:35 pm    Post subject: Reply with quote

If I do use it, for example, in the code above, if I uncomment it, the height and width never get displayed. So, perhaps I should use it at the beginning.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DFL All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group