Search Results

Search found 1890 results on 76 pages for 'resize'.

Page 4/76 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Resize Partition with gparted

    - by arian
    I wanted to create more space for Ubuntu on my hard disk in favor of my windows partition. I booted the livecd and resized the ntfs partition to 100gb. Then I wanted to resize my ubuntu (ext4) partition to fill up the created unallocated space. A screenshot of my current disk. (With the livecd there's no 'key' icon after sda6) My first thought was just right click on sda6 ? move/resize ? done. Unfortunately I cannot resize or move the partition. However I can resize the ntfs partition. I guess it is because the extended sda4 partition is locked. I couldn't see an unlock possibility though… So how do I resize the ext4 partition anyway, probably by unlocking the extended partition, but how? Thanks in advance.

    Read the article

  • Resize and saving an image to disk in Monotouch

    - by Chris S
    I'm trying to resize an image loaded from disk - a JPG or PNG (I don't know the format when I load it) - and then save it back to disk. I've got the following code which I've tried to port from objective-c, however I've got stuck on the last parts. Original Objective-C. This may not be the best way of achieving what I want to do - any solution is fine for me. int width = 100; int height = 100; using (UIImage image = UIImage.FromFile(filePath)) { CGImage cgimage = image.CGImage; CGImageAlphaInfo alphaInfo = cgimage.AlphaInfo; if (alphaInfo == CGImageAlphaInfo.None) alphaInfo = CGImageAlphaInfo.NoneSkipLast; CGBitmapContext context = new CGBitmapContext(IntPtr.Zero, width, height, cgimage.BitsPerComponent, 4 * width, cgimage.ColorSpace, alphaInfo); context.DrawImage(new RectangleF(0, 0, width, height), cgimage); /* Not sure how to convert this part: CGImageRef ref = CGBitmapContextCreateImage(bitmap); UIImage* result = [UIImage imageWithCGImage:ref]; CGContextRelease(bitmap); // ok if NULL CGImageRelease(ref); */ }

    Read the article

  • C++ resize a docked Qt QDockWidget programmatically?

    - by Zac
    I've just started working on a new C++/Qt project. It's going to be an MDI-based IDE with docked widgets for things like the file tree, object browser, compiler output, etc. One thing is bugging me so far though: I can't figure out how to programmatically make a QDockWidget smaller. For example, this snippet creates my bottom dock window, "Build Information": m_compilerOutput = new QTextEdit; m_compilerOutput->setReadOnly(true); dock = new QDockWidget(tr("Build Information"), this); dock->setWidget(m_compilerOutput); addDockWidget(Qt::BottomDockWidgetArea, dock); When launched, my program looks like this: http://yfrog.com/6ldreamidep (bear in mind the early stage of development) However, I want it to appear like this: http://yfrog.com/20dreamide2p I can't seem to get this to happen. The Qt Reference on QDockWidget says this: Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget. QDockWidget will respect them, adjusting its own constraints to include the frame and title. Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked Now, this suggests that one method of going about doing this would be to sub-class QTextEdit and override the sizeHint() method. However, I would prefer not to do this just for that purpose, nor have I tried it to find that to be a working solution. I have tried calling dock-resize(m_compilerOutput-width(), m_compilerOutput-minimumHeight()), calling m_compilerOutput-setSizePolicy() with each of its options...nothing so far has affected the size. Like I said, I would prefer a simple solution in a few lines of code to having to create a sub-class just to change sizeHint(). All suggestions are appreciated.

    Read the article

  • Resize transparent images using C#

    - by MartinHN
    Does anyone have the secret formula to resizing transparent images (mainly GIFs) without ANY quality loss - what so ever? I've tried a bunch of stuff, the closest I get is not good enough. Take a look at my main image: http://www.thewallcompany.dk/test/main.gif And then the scaled image: http://www.thewallcompany.dk/test/ScaledImage.gif //Internal resize for indexed colored images void IndexedRezise(int xSize, int ySize) { BitmapData sourceData; BitmapData targetData; AdjustSizes(ref xSize, ref ySize); scaledBitmap = new Bitmap(xSize, ySize, bitmap.PixelFormat); scaledBitmap.Palette = bitmap.Palette; sourceData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); try { targetData = scaledBitmap.LockBits(new Rectangle(0, 0, xSize, ySize), ImageLockMode.WriteOnly, scaledBitmap.PixelFormat); try { xFactor = (Double)bitmap.Width / (Double)scaledBitmap.Width; yFactor = (Double)bitmap.Height / (Double)scaledBitmap.Height; sourceStride = sourceData.Stride; sourceScan0 = sourceData.Scan0; int targetStride = targetData.Stride; System.IntPtr targetScan0 = targetData.Scan0; unsafe { byte* p = (byte*)(void*)targetScan0; int nOffset = targetStride - scaledBitmap.Width; int nWidth = scaledBitmap.Width; for (int y = 0; y < scaledBitmap.Height; ++y) { for (int x = 0; x < nWidth; ++x) { p[0] = GetSourceByteAt(x, y); ++p; } p += nOffset; } } } finally { scaledBitmap.UnlockBits(targetData); } } finally { bitmap.UnlockBits(sourceData); } } I'm using the above code, to do the indexed resizing. Does anyone have improvement ideas?

    Read the article

  • UIImage resize (Scale proportion)

    - by Mustafa
    The following piece of code is resizing the image perfectly, but the problem is that it messes up the aspect ratio (resulting in a skewed image). Any pointers? // Change image resolution (auto-resize to fit) + (UIImage *)scaleImage:(UIImage*)image toResolution:(int)resolution { CGImageRef imgRef = [image CGImage]; CGFloat width = CGImageGetWidth(imgRef); CGFloat height = CGImageGetHeight(imgRef); CGRect bounds = CGRectMake(0, 0, width, height); //if already at the minimum resolution, return the orginal image, otherwise scale if (width <= resolution && height <= resolution) { return image; } else { CGFloat ratio = width/height; if (ratio > 1) { bounds.size.width = resolution; bounds.size.height = bounds.size.width / ratio; } else { bounds.size.height = resolution; bounds.size.width = bounds.size.height * ratio; } } UIGraphicsBeginImageContext(bounds.size); [image drawInRect:CGRectMake(0.0, 0.0, bounds.size.width, bounds.size.height)]; UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return imageCopy; }

    Read the article

  • Automatically resize jQuery UI dialog to the width of the content loaded by ajax

    - by womp
    I'm having a lot of trouble finding specific information and examples on this. I've got a number of jQuery UI dialogs in my application attached to divs that are loaded with .ajax() calls. They all use the same setup call: $(".mydialog").dialog({ autoOpen: false, resizable: false, modal: true }); I just want to have the dialog resize to the width of the content that gets loaded. Right now, the width just stays at 300px (the default) and I get a horizontal scrollbar. As far as I can tell, "autoResize" is no longer an option for dialogs, and nothing happens when I specify it. I'm trying to not write a separate function for each dialog, so .dialog("option", "width", "500") is not really an option, as each dialog is going to have a different width. Specifying width: 'auto' for the dialog options just makes the dialogs take up 100% of the width of the browser window. What are my options? I'm using jQuery 1.4.1 with jQuery UI 1.8rc1. It seems like this should be something that is really easy. EDIT: I've implemented a kludgy workaround for this, but I'm still looking for a better solution.

    Read the article

  • Resize matrix in latex beamer

    - by John Jiang
    Hi I was wondering how to resize matrices in a beamer environment. Currently I am writing the following code: \begin{align*} \left( \begin{array}{ccccccc} 0 & 1 & & & & & \\ -1 & 0 & & & & & \\ & & 0 & 1 & & & \\ & & -1 & 0 & & & \\ & & & & \ddots & & \\ & & & & & 0 & 1 \\ & & & & & -1 & 0 \end{array} \right) \end{align*} and the matrix takes up almost a whole page. I would like it to be about half a page in height.

    Read the article

  • how to resize image

    - by saadan
    I am a little forgetful have made it many times and can not find the code from the last time I made it how do I get it to resize more than one picture i do like this Guid imageName; imageName = Guid.NewGuid(); string storePath = Server.MapPath("~") + "/MultipleUpload"; if (!Directory.Exists(storePath)) Directory.CreateDirectory(storePath); hif.PostedFile.SaveAs(storePath + "/" + Path.GetFileName(hif.PostedFile.FileName)); string tempPath = "Gallery"; string imgPath = "Galleryt"; string savePath = Path.Combine(Request.PhysicalApplicationPath, tempPath); string TempImagesPath = Path.Combine(savePath, imageName + hif.PostedFile.FileName); string imgSavePath = Path.Combine(Request.PhysicalApplicationPath, imgPath); string ProductImageNormal = Path.Combine(imgSavePath, "t__" + imageName + hif.PostedFile.FileName); string extension = Path.GetExtension(hif.PostedFile.FileName); switch (extension.ToLower()) { case ".png": goto case "Upload"; case ".gif": goto case "Upload"; case ".jpg": goto case "Upload"; case "Upload": hif.PostedFile.SaveAs(TempImagesPath); ImageTools.GenerateThumbnail(TempImagesPath, ProductImageNormal, 250, 350, true, "heigh"); Label1.Text = ""; break; }

    Read the article

  • How to automatically resize an EditText widget (with some attributes) in a TableLayout

    - by steff
    Hi everyone, I have a layout issue. What I do is this: create TableLayout in xml with zero children: <TableLayout android:id="@+id/t_layout_contents" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/l_layout_tags" android:stretchColumns="1" android:paddingLeft="5dip" android:paddingRight="5dip" /> Insert first row programmatically in onCreate(): tLayoutContents = (TableLayout)findViewById(R.id.t_layout_contents); NoteElement nr_1 = new NoteElement(this); tLayoutContents.addView(nr_1); Class "NoteElement" extends TableRow. The 1st row just consists of a blank ImageView as a placeholder and an EditText to enter text. NoteElement's constructor looks like this: public NoteElement(Context c) { super(c); this.context = c; defaultText = c.getResources().getString(R.string.create_note_help_text); imageView = new ImageView(context); imageView.setImageResource(android.R.color.transparent); LayoutParams params = new LayoutParams(0); imageView.setLayoutParams(params); addView(imageView); addView(addTextField()); } Method addTextField() specifies the attributes for the EditText widget: private EditText addTextField() { editText = new EditText(context); editText.setImeOptions(EditorInfo.IME_ACTION_DONE); editText.setMinLines(4); editText.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); editText.setHint(R.string.create_note_et_blank_text); editText.setAutoLinkMask(Linkify.ALL); editText.setPadding(5, 0, 0, 0); editText.setGravity(Gravity.TOP); editText.setVerticalScrollBarEnabled(true); LayoutParams params = new LayoutParams(1); editText.setLayoutParams(params); return editText; } So far, so good. But my problem occurs as soon as the available space for the chars is depleted. The EditText does not resize itself but switches to a single line EditText. I am desperatly looking for a way in which the EditText resizes itself in its height dynamically, being dependant on the inserted text length. Does anyone have a hint on this? Thanks & regards, steff

    Read the article

  • UITextView doesn't not resize when keyboard appear if loaded from a tab bar cotroller

    - by elio.d
    I have a simple view controller (SecondViewController) used to manage a UITextview (I'm building a simple editor) this is the code of the SecondViewController.h @interface SecondViewController : UIViewController { IBOutlet UITextView *textView; } @property (nonatomic,retain) IBOutlet UITextView *textView; @end and this is the SecondViewController.m // // EditorViewController.m // Editor // // Created by elio d'antoni on 13/01/11. // Copyright 2011 none. All rights reserved. // @implementation SecondViewController @synthesize textView; /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"uiViewBg.png"]]; textView.layer.borderWidth=1; textView.layer.cornerRadius=5; textView.layer.borderColor=[[UIColor darkGrayColor] CGColor]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil]; } -(void) matchAnimationTo:(NSDictionary *) userInfo { NSLog(@"match animation method"); [UIView setAnimationDuration:[[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]]; [UIView setAnimationCurve:[[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; } -(CGFloat) keyboardEndingFrameHeight:(NSDictionary *) userInfo { NSLog(@"keyboardEndingFrameHeight method"); CGRect keyboardEndingUncorrectedFrame = [[ userInfo objectForKey:UIKeyboardFrameEndUserInfoKey ] CGRectValue]; CGRect keyboardEndingFrame = [self.view convertRect:keyboardEndingUncorrectedFrame fromView:nil]; return keyboardEndingFrame.size.height; } -(CGRect) adjustFrameHeightBy:(CGFloat) change multipliedBy:(NSInteger) direction { NSLog(@"adjust method"); return CGRectMake(20, 57, self.textView.frame.size.width, self.textView.frame.size.height + change * direction); } -(void)keyboardWillAppear:(NSNotification *)notification { NSLog(@"keyboard appear"); [UIView beginAnimations:nil context:NULL]; [self matchAnimationTo:[notification userInfo]]; self.textView.frame = [self adjustFrameHeightBy:[self keyboardEndingFrameHeight: [notification userInfo]] multipliedBy:-1]; [UIView commitAnimations]; } -(void)keyboardWillDisappear:(NSNotification *) notification { NSLog(@"keyboard disappear"); [UIView beginAnimations:nil context:NULL]; [self matchAnimationTo:[notification userInfo]]; self.textView.frame = [self adjustFrameHeightBy:[self keyboardEndingFrameHeight: [notification userInfo]] multipliedBy:1]; [UIView commitAnimations]; } // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } (void)dealloc { [super dealloc]; } @end the problem is that if load the view controller from a tab bar controller the textView doesn't resize when the keyboard appear, but the SAME code works if loaded as a single view based app. I hope I was clear enough. I used the tabBar template provided by xcode no modifications.

    Read the article

  • NSOpenGLView resize on window resize

    - by ADAM
    I have a class called ModelView which inherits from NSOpenGLView. When my program runs i attach the ModelView as follows to the main window. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application ModelView *glView; NSRect glViewRect = CGRectMake(0.0f, 0.0f, window.frame.size.width, window.frame.size.height); glView = [[ModelView alloc] initWithFrame: glViewRect]; [[window contentView] addSubview:glView]; } In my ModelView class i have a reshape function which is firing every time the window resizes - (void)reshape { [super setNeedsDisplay:YES]; [[self openGLContext] update]; NSLog(@"reshap function called"); } I want to get the main window width so i can resize the ModelView but i cant find how to get the window width from the ModelView class I am reasonably new to cocoa/objective-c Any help appreciated

    Read the article

  • UIScrollview doesnt resize in NavigationController when rotated

    - by Icky
    Hey, I have been dealing with this issue for 2 days now, not able to find a solution. I have a navigationcontroller as a root view controller. This one pushes a UIViewcontroller which in turn has a UIScrollview I created with IB. Additionally there is the Navigation bar. My problem arises, when I rotate the IPhone to Landscape mode. In -(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation I want my scrollview to take up the full width (480 px) which it doesnt. I am able to set the frame of the navigation bar to full width perfectly fine, but not the scrollview. I have read that this might be because of the autoresizing masks set in the rooviewcontroller but I have tried out a couple of solutions - none worked for me. Any ideas on how to challenge the problem? Dont know where to start looking.

    Read the article

  • Crop and Resize Image to Specific Dimensions

    - by Crunchy
    I need some help cropping and resizing images using CSharp.net. My goal here is to take an image and reduce it to 50px by 50px. The following code I found here will do that, however it's scaling the image as well. Ideally I want to scale the image down to as close to 50px by 50px as possible and then remove the parts of the image that are outside 50px by 50px. public Image ResizeImage(Image img, int width, int height) { Bitmap b = new Bitmap(width, height); using (Graphics g = Graphics.FromImage((Image)b)) { g.DrawImage(img, 0, 0, width, height); } return (Image)b; }

    Read the article

  • Resize a WPF window, but maintain proportions?

    - by rathkopf
    I have a user resizable WPF Window that I want to constrain the resizing so the aspect ratio of the window stays constant. Ideally I would like to constrain mouse location when the window is being resized by dragging a corner to positions that maintain the proper aspect ration. If an edge is resized with the mouse, the other dimension should change at the same time. Is there a simple way to do this or a good on-line example that anyone knows of? If no better solutions come up, I'll post what I've done after I've refined it a bit.

    Read the article

  • Java 2D Resize

    - by jon077
    I have some old Java 2D code I want to reuse, but was wondering, is this the best way to get the highest quality images? public static BufferedImage getScaled(BufferedImage imgSrc, Dimension dim) { // This code ensures that all the pixels in the image are loaded. Image scaled = imgSrc.getScaledInstance( dim.width, dim.height, Image.SCALE_SMOOTH); // This code ensures that all the pixels in the image are loaded. Image temp = new ImageIcon(scaled).getImage(); // Create the buffered image. BufferedImage bufferedImage = new BufferedImage(temp.getWidth(null), temp.getHeight(null), BufferedImage.TYPE_INT_RGB); // Copy image to buffered image. Graphics g = bufferedImage.createGraphics(); // Clear background and paint the image. g.setColor(Color.white); g.fillRect(0, 0, temp.getWidth(null),temp.getHeight(null)); g.drawImage(temp, 0, 0, null); g.dispose(); // j2d's image scaling quality is rather poor, especially when // scaling down an image to a much smaller size. We'll post filter // our images using a trick found at // http://blogs.cocoondev.org/mpo/archives/003584.html // to increase the perceived quality.... float origArea = imgSrc.getWidth() * imgSrc.getHeight(); float newArea = dim.width * dim.height; if (newArea <= (origArea / 2.)) { bufferedImage = blurImg(bufferedImage); } return bufferedImage; } public static BufferedImage blurImg(BufferedImage src) { // soften factor - increase to increase blur strength float softenFactor = 0.010f; // convolution kernel (blur) float[] softenArray = { 0, softenFactor, 0, softenFactor, 1-(softenFactor*4), softenFactor, 0, softenFactor, 0}; Kernel kernel = new Kernel(3, 3, softenArray); ConvolveOp cOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null); return cOp.filter(src, null); }

    Read the article

  • Resize view on iPhone when rotating

    - by BCBomb47
    I have an application with many views. I want only a couple of the views to be able to rotate to landscape when the device is rotated. I found out that I couldn't use (BOOL)shouldAutorotateToInterfaceOrientation because that would rotate every view in my app. I found a solution to this problem here on Stack Overflow but now I have another issue to deal with. The view rotates when I turn the device but it still shows the view as if it were still in portrait mode (straight up and down). The top and bottom of the view is cut off. Is there a way to have the view rotate and also adjust its size to fit the new orientation? I also found this but wasn't able to get it to work. Here's my code for that view: @implementation businessBank @synthesize webView, activityIndicator; - (void)viewDidLoad { [super viewDidLoad]; NSString *urlAddress = @"website_url"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil]; } - (void)didRotate:(NSNotification *)notification { UIDeviceOrientation orientation = [[notification object] orientation]; if (orientation == UIDeviceOrientationLandscapeLeft) { [self.view setTransform:CGAffineTransformMakeRotation(M_PI / 2.0)]; } else if (orientation == UIDeviceOrientationLandscapeRight) { [self.view setTransform:CGAffineTransformMakeRotation(M_PI / -2.0)]; } else if (orientation == UIDeviceOrientationPortraitUpsideDown) { [self.view setTransform:CGAffine TransformMakeRotation(M_PI)]; } else if (orientation == UIDeviceOrientationPortrait) { [self.view setTransform:CGAffineTransformMakeRotation(0.0)]; } }

    Read the article

  • Java: Detecting image format, resize (scale) and save as JPEG

    - by BoDiE2003
    This is the code I have, it actually works, not perfectly but it does, the problem is that the resized thumbnails are not pasting on the white Drawn rectangle, breaking the images aspect ratio, here is the code, could someone suggest me a fix for it, please? Thank you import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ImageScalerImageIoImpl implements ImageScaler { private static final String OUTPUT_FORMAT_ID = "jpeg"; // Re-scaling image public byte[] scaleImage(byte[] originalImage, int targetWidth, int targetHeight) { try { InputStream imageStream = new BufferedInputStream( new ByteArrayInputStream(originalImage)); Image image = (Image) ImageIO.read(imageStream); int thumbWidth = targetWidth; int thumbHeight = targetHeight; // Make sure the aspect ratio is maintained, so the image is not skewed double thumbRatio = (double)thumbWidth / (double)thumbHeight; int imageWidth = image.getWidth(null); int imageHeight = image.getHeight(null); double imageRatio = (double)imageWidth / (double)imageHeight; if (thumbRatio < imageRatio) { thumbHeight = (int)(thumbWidth / imageRatio); } else { thumbWidth = (int)(thumbHeight * imageRatio); } // Draw the scaled image BufferedImage thumbImage = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB); System.out.println("Thumb width Buffered: " + thumbWidth + " || Thumb height Buffered: " + thumbHeight); Graphics2D graphics2D = thumbImage.createGraphics(); // Use of BILNEAR filtering to enable smooth scaling graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); // graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null); // White Background graphics2D.setPaint(Color.WHITE); graphics2D.fill(new Rectangle2D.Double(0, 0, targetWidth, targetHeight)); graphics2D.fillRect(0, 0, targetWidth, targetHeight); System.out.println("Target width: " + targetWidth + " || Target height: " + targetHeight); // insert the resized thumbnail between X and Y of the image graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null); System.out.println("Thumb width: " + thumbWidth + " || Thumb height: " + thumbHeight); // Write the scaled image to the outputstream ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(thumbImage, OUTPUT_FORMAT_ID, out); return out.toByteArray(); } catch (IOException ioe) { throw new ImageResizingException(ioe); } } }

    Read the article

  • Resize form based on if subform visible

    - by dmr
    I have a form with a subform on it. If subform contains no records, it's visible property is false. In that case, I'd like the outer form to shrink so that there isn't a big empty space where the subform was. The long way to do this would be by setting the position for all the controls on the form based on whether the subform is visible. However, is there an easier way to do this (maybe with the can grow/ can shrink property)?

    Read the article

  • How to resize form to fit DataGridView?

    - by slave016
    I have a form that contains dataGridView, whose coloumn are set to dgrv1.Width =dgrv1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible)+20; I want to make the form to automaticaly follow the with of dataGridView... Also, on maximized, I would like it to grow in height only. Any sugestions?

    Read the article

  • Resize the /var directory in redhat enterprise edition 4

    - by Sri
    I am running NDB mysql. the log files fills up the /var directory. therefore i cant start the ndbd service now. as a temporary fix, i have deleted the log files and again working fine. but again the log files fill up the /var directory. i got plenty of space in other partition. therefore i would like to swap the partition from one directory to /var. here if my input from df -h Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 ext3 54G 2.9G 49G 6% / /dev/cciss/c0d0p1 ext3 99M 14M 81M 14% /boot none tmpfs 1013M 0 1013M 0% /dev/shm /dev/cciss/c0d0p2 ext3 9.7G 9.7G 0 100% /var there are plenty of space in /dev/mapper/VolGroup00-LogVol00. Therefore i will like to swap 10 G space from this directory to /var. could you please help me out to solve this problem?

    Read the article

  • Java: Detecting image formate - resize (scale) and save as JPEG

    - by BoDiE2003
    This is the code I have, it actually works, not perfectly but it does, the problem is that the resized thumbnails are not pasting on the white Drawn rectangle, breaking the images aspect ratio, here is the code, could someone suggest me a fix for it, please? Thank you import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ImageScalerImageIoImpl implements ImageScaler { private static final String OUTPUT_FORMAT_ID = "jpeg"; // Re-scaling image public byte[] scaleImage(byte[] originalImage, int targetWidth, int targetHeight) { try { InputStream imageStream = new BufferedInputStream( new ByteArrayInputStream(originalImage)); Image image = (Image) ImageIO.read(imageStream); int thumbWidth = targetWidth; int thumbHeight = targetHeight; // Make sure the aspect ratio is maintained, so the image is not skewed double thumbRatio = (double)thumbWidth / (double)thumbHeight; int imageWidth = image.getWidth(null); int imageHeight = image.getHeight(null); double imageRatio = (double)imageWidth / (double)imageHeight; if (thumbRatio < imageRatio) { thumbHeight = (int)(thumbWidth / imageRatio); } else { thumbWidth = (int)(thumbHeight * imageRatio); } // Draw the scaled image BufferedImage thumbImage = new BufferedImage(thumbWidth, thumbHeight, BufferedImage.TYPE_INT_RGB); System.out.println("Thumb width Buffered: " + thumbWidth + " || Thumb height Buffered: " + thumbHeight); Graphics2D graphics2D = thumbImage.createGraphics(); // Use of BILNEAR filtering to enable smooth scaling graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); // graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null); // White Background graphics2D.setPaint(Color.WHITE); graphics2D.fill(new Rectangle2D.Double(0, 0, targetWidth, targetHeight)); graphics2D.fillRect(0, 0, targetWidth, targetHeight); System.out.println("Target width: " + targetWidth + " || Target height: " + targetHeight); // insert the resized thumbnail between X and Y of the image graphics2D.drawImage(image, 0, 0, thumbWidth, thumbHeight, null); System.out.println("Thumb width: " + thumbWidth + " || Thumb height: " + thumbHeight); // Write the scaled image to the outputstream ByteArrayOutputStream out = new ByteArrayOutputStream(); ImageIO.write(thumbImage, OUTPUT_FORMAT_ID, out); return out.toByteArray(); } catch (IOException ioe) { throw new ImageResizingException(ioe); } } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >