473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Resizing Images

Ali Rizwan
925 512MB
Hi all,
I was busy for a long time for a project.
Now my question is that how can i resize any image like Jpg or bmp to the size of my form or screen resolution for example if screen resolution is 1024 x 768 then image resized to 1024 x 768.
Is there any other way except Paintpicture???

Thanx

>> ALI <<
May 9 '08 #1
5 1626
lotus18
866 512MB
Hi all,
I was busy for a long time for a project.
Now my question is that how can i resize any image like Jpg or bmp to the size of my form or screen resolution for example if screen resolution is 1024 x 768 then image resized to 1024 x 768.
Is there any other way except Paintpicture???

Thanx

>> ALI <<
Hi

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Image1.Picture = LoadPicture("C:\MyImage.bmp")
  3. End Sub
  4.  
  5. Private Sub Form_Resize()
  6.     Image1.Width = Me.Width
  7.     Image1.Height = Me.Height
  8. End Sub
I'm just using an image control. Note: place the control at point 0,0 of your form and make your control (Image1) stretch property = true : )

Rey Sean
May 10 '08 #2
Ali Rizwan
925 512MB
Hi

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Image1.Picture = LoadPicture("C:\MyImage.bmp")
  3. End Sub
  4.  
  5. Private Sub Form_Resize()
  6. Image1.Width = Me.Width
  7. Image1.Height = Me.Height
  8. End Sub
I'm just using an image control. Note: place the control at point 0,0 of your form and make your control (Image1) stretch property = true : )

Rey Sean
Thanx lotus but i dont mean like this i mean actual resizing. Actually i m creating a virtual desktop app and i want to add wallpaper features like in windows desktop, in which we can center, tile and stretch any wallpaper.

I hope you understand my problem.

Thanx
>> ALI <<
May 10 '08 #3
Hi all,
I was busy for a long time for a project.
Now my question is that how can i resize any image like Jpg or bmp to the size of my form or screen resolution for example if screen resolution is 1024 x 768 then image resized to 1024 x 768.
Is there any other way except Paintpicture???

Thanx

>> ALI <<
you can get the screen size from screen.width and screen.height coding and you use the height and width to your form and image.
May 12 '08 #4
jamesd0142
469 256MB
Hi,

what version are you using these days?
I think i remember you saying you moved onto vb2008?

See if this code is any use i use it to good effect.
Expand|Select|Wrap|Line Numbers
  1.  Private Sub SaveResized
  2.  
  3.         Dim bm As New Bitmap(PictureBox2.Image)
  4.  
  5.         Dim myX As Integer
  6.  
  7.         Dim myY As Integer
  8.  
  9.         myX = 800
  10.  
  11.         myY = 600
  12.  
  13.         If myY = 0 Or myX = 0 Then Exit Sub Else 
  14.  
  15.         Dim thumb As New Bitmap(myX, myY)
  16.  
  17.         Dim g As Graphics = Graphics.FromImage(thumb)
  18.  
  19.         g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
  20.  
  21.         g.DrawImage(bm, New Rectangle(0, 0, myX, myY), New Rectangle(0, 0, bm.Width, bm.Height), GraphicsUnit.Pixel)
  22.  
  23.         g.Dispose()
  24.  
  25.         Dim message, title, defaultValue As String
  26.  
  27.         'Dim myValue As String
  28.  
  29.         'message = "Enter File Name:" ' Set prompt.
  30.  
  31.         'title = "Save Resized Photo" ' Set title.
  32.  
  33.         defaultValue = "" ' Set default value.
  34.  
  35.         'get name to save resized image, using Inputbox
  36.  
  37.         'myValue = InputBox(message, title, defaultValue)
  38.  
  39.         'If myValue = "" Then bm.Dispose() : thumb.Dispose() : Exit Sub Else 
  40.  
  41.         thumb.Save("C:\temp\resized\" & i & ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
  42.  
  43.         bm.Dispose()
  44.  
  45.         thumb.Dispose()
  46.  
  47.         'Dim caption As String = "Save Resized Photo"
  48.  
  49.         'MessageBox.Show("The Resized Photo has been saved as: " & i, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  50.  
  51.     End Sub
  52.  
This is vb2005 code

James
May 12 '08 #5
Ali Rizwan
925 512MB
Thanx James.
I ll convert this to vb6 format.
and i m also using vb2008 but i make my applications on vb6 till i got full control on vb2008.

Thanx
>> ALI <<
May 14 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: lawrence | last post by:
Can someone please tell me where I can get some open source code for resizing images? I know such code has been written a million times and I don't feel like doing it again from scratch.
4
by: Matthias Czapla | last post by:
Hi! I want to resize uploaded GIF images. Currently I do it like this: <?php // ... $img = imagecreatefromgif($path); $img_scaled = imagecreate($new_width, $new_height);...
2
by: Alex Hopson | last post by:
I'm using the code below to loop through some images and resize each image twice, once to create a thumbnail and once to create a small image. The page stops loading around the 38th image out of...
10
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger...
9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
13
by: Jon Yeager | last post by:
I need to display a bunch of pictures that are all of various dimensions into a fixed dimension space, like MSN Messenger does with its user photos in the chat windows. Forcing image dimensions...
5
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
1
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image...
6
by: tomasio | last post by:
Dear NG, years have passed and I am still more designer than programmer. I build a new version of my website which has a few nasty bugs, especially on my startpage: Resizing text brakes the...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.