Resize Image C# / Specific Format (widescreen 16:9)?
Feb 24, 2011
I am searching for a way to resize and crop images to a specific size in a fixed ratio like 16:9. So I have any image and any size and it should be resized and cropped in a ratio 16:9.
Just cropping is not very nice. I want that the image is resized more and if necessary maybe cropped. Or better: I want to reuse as much as possible from the original image but resize and crop it centered so I could use it in a fixed html div with a ration of 16:9.
I found this code on another site and it works great for resizing the image and keeping the quality. What I want to do at the end is check the height of the image and if it exceeds a certain number, just change the size of the image. Not resize it but just cut off part of the bottom to be a certain size.
Code: Dim image As System.Drawing.Image = System.Drawing.Image.FromFile(src) Dim srcWidth As Integer = image.Width Dim srcHeight As Integer = image.Height Dim thumbHeight As Integer = (srcHeight / srcWidth) * thumbWidth Dim bmp As New Drawing.Bitmap(thumbWidth, thumbHeight)
i am using file upload control for uploading images. in that iam checking the condition,if Image.Width > 250 || Image.Height > 400 then i am resizing the image. but it is giving the error "The SaveAs method is configured to require a rooted path, and the path 'ProductImages/roman_sandals.jpg' is not rooted."
ProductImages is folder where i am saving image. Can anyone find why this is giving error,my code is
display images in small size (thumnails) and also resize the image size (kb) so the page will quickly upload images. i dont want the user will upload 2 version of images (large and small) and i dont want also to resize the image size while uploading the images to server. I want the user will upload the original images (320x480 px) and when the users will watch the gallery they will see small images (120x180px) with small kb size that will uploads fast.
I have a working application to save an image file to my sql database (Saves as "Original_Image" in the DB TBL_ImageGallery). I have a file limit on the upload of 1 MB. This also works great and the image is being saved beautifully. I found a bit of an issue. Being i am working on a network with 2 bonded T1 connections the streaming of images to my site, when tested internally, is effortless. I am not sure that this will be the same with a generic bandwidth. I want to store the original image size into the databse (already done) but also store a smaller sized (in bytes not actual size [Width, Height]) to my database in a "ThumbNail" column. This will allow the browser to only have to pass the "Thumbnail" sized image, obviously this needs to be much smaller than the original (ex: 1MB orignal I want to save as 12KB image in the thumbnail column), to the thumbnail img control in the user's interface.
I am not sure if this is possible or if there is a need of third party controls. I am interested in doing this as either a stored procedure or in the C# code on an event fire. There may be a better / other solution to this and if that is the case I am also interested
I have a page which allows the user to upload pictures. The problem is that my old users can't resize the image themselves. I want to allow them to upload any size of image and then when the server gets it, it will create a small copy of this picture.
I want to know some codes on how can i resize the selected image in fileupload control and then Upload it in MS Access Database. I am using VB in coding. The only thing I know is that I can save it as an ole object in the database and it will be saved like a string. But I don't know some codes for this one.
i am facing a prblem about image resizing.. i know it is a common problem but the scinario is little different here. i have some image in my server image directory and also have their small 128 X 128 sized thumbnail..i show a page with those images like 'facebook photo album' and also linked another page to display them..when a picture is clicked it refferd to that page and that page loads the full sized original image along with picture comments bla bla..., the page width is fixed to 1024px, and the div's width is 800px max which contains the <asp:image..../>; that shows the full sized image. here the problem comes, when a original sized picture is greater that 800px then the remaining part of the picture is croped !! i know it will happen.. that is why i planned to show a thumbnail like pic which's size will be 800px max and link the page with a pop up java script page which will contain the full sized picture only. the problem is i can't resize the picture in a limit of 800px on fly.
I have googled around for a solution and it seems that a lot of posts are dealing with these kind of things. Unfortunatley none of them seem to help me. I'm trying to resize an image dynamically to create a thumbnail. I'm basically loading a current JPEG into an image object and using the following commands to create a new image:
I put the image which I get from the code next to a manual re-size which was made in Photoshop. You cannot even compare between the two, the dynamic one looks so blurry when you compare it to the one made in Photoshop. Is there a way around this? I imagine Microsoft found a solution for this by now. Otherwise I will have to upload manually 4-5 different versions to every image on my website which doesn't sound right to me.
How it is possible to dynamically resize an image using an image handler nd web.config file?like i want each image uploaded by user to be resized to a specific size(aspect ratio) before being upload to server from database i also want that the resized image must not loose its Aspect ratio.
I need to resize a photo selected by a user with a fileUpload control and upload to a database. What i can just do now is upload the image to a database table. Imjust trying to find out how to code the image resizing part and when i say resize, i mean the dimensions and file size.