Scaling pictures

Hello,

imagine you have a picture taken by your iPhone but it’s way bigger than it has to be for your app and its eating up all your storage,
i have this problem but i have a solution.
I want to make an app which makes the iPhone taken picture into a square with a white background.
This can be done with a MacBook but the problem is, instead of white boards it has black, can anyone please help me to solve that issue?

i would be very thankful for your help

Using Xojo:

create a new Picture with your prefered size,
open the photo,
DrawPicture your image inside the created picture

More info there:

to load (and save later) the image
http://documentation.xojo.com/index.php/FolderItem

to resize the image:
http://documentation.xojo.com/index.php/Graphics.DrawPicture

In general, the documetation is your best friend.

thanks :smiley:

@Emile Schwarz , how can i do it?

i don’t get it, i’m sorry

see my FAQ:
http://www.monkeybreadsoftware.net/faq-howtoscaleapictureproportionally.shtml

You may need to change that code to use iOS classes!

Channel is General.

@Emile Schwarz I don’t know if Dante needs it for a Xojo project for desktop or for iOS. The FAQ entry is for desktop.

@Christian:

We need more data from Dante to give him a better advice.

Dante ?
What kind of application do you want to create: Desktop or iOS ?

Care to expand what you do not get ?

http://documentation.xojo.com/index.php/Graphics
Graphics.DrawPicture:
Draws the picture at the specified location. The picture can be shown at full size, cropped, or scaled. All units are pixels.

Or:
http://developer.xojo.com/iosgraphics
DrawImage ?

I’m sorry for not putting so much information,

i want to create an desktop application in Xojo,
it should put pictures, like an iPhone taken picture into a field of 1000x1000 pixels (bigger pictures just take storage from the server)

it should look similar to the function in Instagram where you can find the white boarders on the outside but the picture is still square

i tried some options but the summary isn’t that what i need

what i think of drawing an square picture of a white field (plane field) and putting the other one promotional on top of that

If you go through Dante’s posts you can see he’s using the Web framework.
Please don’t try to correct others when you don’t know the answer yourself, Christian was only trying to help and be clear.

No, I do not saw that, sorry (and that was why I asked).

I don’t (in this case).

I do not understand the question (and thus why I asked more data).

That was what I wanted to do too.

Dante:

Here is a step by step of what you have to do to achieve your goal.

But, first of all, I do not know anything about iPhone (format of the photos) nor what is Instagram (!).

  1. Copy the photos from iPhone to a folder in your MacBook,
  2. Fire Xojo,
  3. Add a button (or a MenuItem in the File Menu) to allow you to open a photo (or the whole photos folder).

You will find explanations and code to do that here:
http://documentation.xojo.com/index.php/FolderItem

  1. You used SelectFolder to choose the Photos Folder.
    Now you have to iterate the Photos folder contents.

a. Get the number of items in the Photos Folder,
b. Add a Loop block (For Loop_Idx = 1 to PhotosCnt …/… Next)

You will find explanations and code to add a loop here:
http://developer.xojo.com/For

In that loop, you have to use code to:
load an individual photo,
create a new Picture using the just loaded photo width and height
to be sure to not have a black backgound, draw it using the white color.
then resize the Picture to the size you want, placing it at 0,0 or 10,10 (if you want a white margin of 10,10 pixels…
DrawPicture also allows you to resize the original Picture (Photo).
then save the image into a different folder,
then you are done.

Most of the code is available with explanations here:

http://developer.xojo.com/graphics
http://developer.xojo.com/userguide/pictures

etc.

You can also check the Examples folder for… examples.

At last, come back here when you will have questions.

i bought an tool which i found at code canyon for 7$…

that’s an application, that creates thumbnails and i can use this for my need,

with one click it’s scaling the picture proportional but where the dress unknown space is, are transparent or white bars set