Search Results

Search found 170 results on 7 pages for 'cropping'.

Page 1/7 | 1 2 3 4 5 6 7  | Next Page >

  • Cropping a line (laser beam) in XNA

    - by electroflame
    I have a laser sprite that I wish to crop. I want to crop it so when it collides with an item, I can calculate the distance between the starting point, and the ending point, and only draw that. This eliminates the "overdraw" of a laser drawing past an item. Essentially, I'm trying to crop a line, but also keep that line "attached" to the nose of my ship. The line should not be drawn past the nose of my ship, that should be the starting point. There is no rotation to worry about. Currently, I thought that doing this through SpriteBatch would be best. This is my current Spritebatch code: spriteBatch.Draw(Laser.sprite, new Rectangle((int)Laser.position.X, (int)Laser.position.Y, Laser.sprite.Width, LaserHeight), new Rectangle(0, 0, (int)(Laser.sprite.Width), LaserHeight), new Color(255, 255, 255, (byte)MathHelper.Clamp(Laser.Alpha, 0, 255)), Laser.rotation, new Vector2(Laser.sprite.Width/2, LaserHeight/2), SpriteEffects.None, 0); But this doesn't quite work. It does only draw part of the sprite, but when LaserHeight is incremented, it lengthens the line in both ways! I believe this is due to some stupid error on my part with the Origin of the draw. Quick recap: I need to have my laser sprite drawn with the bottom of it at the nose of my ship, and then use LaserHeight to crop the image so only part of it is drawn. I have a feeling my explanation is a bit...lacking. So if you require more information, please say so and I will try to provide more information. Thanks in advance!

    Read the article

  • C# images cropping,splitting,saving

    - by cheesebunz
    Hi, as stated in subject, i have an image: private Image testing; testing = new Bitmap(@"sampleimg.jpg"); I would like to split it into 3 x 3 matrix meaning 9 images in total and save it.Any tips or tricks to do this simple? I'm using visual studios 2008 and working on smart devices. Tried some ways but i can't get it. This is what i tried: int x = 0; int y = 0; int width = 3; int height = 3; int count = testing.Width / width; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); for (int i = 0; i < count; i++) { g.Clear(Color.Transparent); g.DrawImage(testing, new Rectangle(0, 0, width, height), new Rectangle(x, y, width, height), GraphicsUnit.Pixel); bmp.Save(Path.ChangeExtension(@"C\AndrewPictures\", String.Format(".{0}.bmp",i))); x += width; }

    Read the article

  • How does Facebook codes their Cropping tool?

    - by Trip
    I ask this because I am currently trying to work out my own technique, and there are huge strategic hangups for the entire site when your begin this. Of them are: Using jCrop and rMagick, it takes up a huge amount of processing ( to which I have backgrounded ). Because I have it backgrounded, I must by ajax develop a feature that auto-updates every five seconds to check when the backgrounding is done. Has anyone accomplished this with their sites? If so, what are some creative techniques you came across to keep the processing streamline, and the users happy?

    Read the article

  • Presenting an image cropping interface

    - by wkw
    I'm trying to engineer a UI for cropping images in iphone OS and suspect I'm going about things the hard way. My goal is pretty much what the Tapbots duo have done with Pastebot. In that app, they dim the source image but provide a movable and resizable cropping view and the image you're cropping is in a zoomable scrollview; when you resize or move the underlying image, the cropping view adjusts appropriately. I mocked up a composite image which will give a sense of the design I'm after, along with how I presently have my view hierarchy setup, viewable here The approach I've started with is the following: UIImageView with the image to crop is in a scrollview, a plain UIView with black fill and suitable transparency/alpha setting is added in front of the imageview. I then use a custom UIView which is a sibling to the scrollview at a higher level, which implements the drawRect: method and for the most part calls CGImageCreateWithImageInRect to get the portion of the image's bitmap that matches the position of the cropping view and draws that to the CGContext. in the viewcontroller I'm using the UIScrollViewDelegate methods to track scrolling and passing those changes to the custom cropping UIView so it stays in sync with the scroll contentOffset. That much is finally working. But trying to keep in sync as the scrollview zoomScale changes is when I figured I should ask for help. Looking for suggestions or guidance. My initial approach just seems like more work than is required. Could this be done with a masking layer in the ImageView? And if so, how would I setup the tracking for moving and resizing the cropping rect? My experience working with layers is non-nil, but very limited thus far.

    Read the article

  • Looking for mass cropping software

    - by Bart van Heukelom
    I'm looking for a tool than runs on Ubuntu that can let me: Open an image in a folder which has thousands Crop and rotate it Save as a copy, automatically named (not manually), with one click. Preferably with something in the name that I can later use to filter these cropped copies in Nautilus (unless it saves in another directory, that'd be even better). Move to next image and repeat Does it exist?

    Read the article

  • Cropping images & SEO

    - by user1181950
    So I have a page with a bunch of images with largely varying sizes. Also the layout of the page is such that the images are all in the shape of square tiles, so just resizing will cause distorted images. What I've been doing previously is when users upload images, I resize and crop them appropriately and display the new image as the thumbnail and load full image when user clicks on it. However, I just realized this is an issue with SEO as google will crawl the thumbnails and stick the thumbnails on Google Images instead of the full images. Is there any way to show a cropped/resized image but have Google Image show the full image? I can do something with css using an enclosing div and overflow:hidden, but I'd imagine the performance on that would be pretty bad. Any suggestions? Thanks! PS. I saw this (Make google index the actual image not the thumbnail), but in my case I have users continuously uploading images, and the database of images is always changing and pretty big (thousands), so sitemap will be pretty unwieldy..

    Read the article

  • Projecting onto different size screens by cropping

    - by Jason
    Hi, I am building a phone application which will display a shape on screen. The shape should look the same on different screen sizes. I. Decided the best way to do this is to show more of the background on larger screen keeping the shapes proportion the same on all screens. My problem is I am not sure how to achieve this, I can query the screen size at runtime and calculate how different it is from the six is designed for but I am not sure what to do with this value. What kind of projection should I use for my orthographic matrix an hour will I display more on larger screens and not loose information on smaller screens? Thanks, Jason.

    Read the article

  • Best way to mask 2D sprites in XNA?

    - by electroflame
    I currently am trying to mask some sprites. Rather than explaining it in words, I've made up some example pictures: The area to mask (in white) Now, the red sprite that needs to be cropped. The final result. Now, I'm aware that in XNA you can do two things to accomplish this: Use the Stencil Buffer. Use a Pixel Shader. I have tried to do a pixel shader, which essentially did this: float4 main(float2 texCoord : TEXCOORD0) : COLOR0 { float4 tex = tex2D(BaseTexture, texCoord); float4 bitMask = tex2D(MaskTexture, texCoord); if (bitMask.a > 0) { return float4(tex.r, tex.g, tex.b, tex.a); } else { return float4(0, 0, 0, 0); } } This seems to crop the images (albeit, not correct once the image starts to move), but my problem is that the images are constantly moving (they aren't static), so this cropping needs to be dynamic. Is there a way I could alter the shader code to take into account it's position? Alternatively, I've read about using the Stencil Buffer, but most of the samples seem to hinge on using a rendertarget, which I really don't want to do. (I'm already using 3 or 4 for the rest of the game, and adding another one on top of it seems overkill) The only tutorial I've found that doesn't use Rendertargets is one from Shawn Hargreaves' blog over here. The issue with that one, though is that it's for XNA 3.1, and doesn't seem to translate well to XNA 4.0. It seems to me that the pixel shader is the way to go, but I'm unsure of how to get the positioning correct. I believe I would have to change my onscreen coordinates (something like 500, 500) to be between 0 and 1 for the shader coordinates. My only problem is trying to work out how to correctly use the transformed coordinates. Thanks in advance for any help!

    Read the article

  • Word 2010 is automatically cropping image being insterted

    - by truthseeker
    Word 2010 is automatically cropping image being insterted like this: The million dollar question is why? I have this problem only in this particular section of this document. There is no such problem in another sections of document. The one possibility how to display whole area of image is to use floating layout like the first image in presented screenshot. But this solution has disadvantage that I have to manually format image positions after changes in text before.

    Read the article

  • Trimming / cropping a movie file ?

    - by ldigas
    Now, I'm not really sure what's the exact term here. As far as I saw, cropping is related to video size. I need a program to trim some parts of the video file. On a timescale, for example, from 0-60s, I'd like to trim the parts from 14-20s, and from 30-35s. Can anyone give a recommendation for such an application ? The movie in question is a .MOV file, so Windows Movie Maker doesn't work.

    Read the article

  • Contending with Smartart cropping bug in Word 2007

    - by Michael
    I recently discovered and started using the Smartart tool in Microsoft Word 2007. It's a great tool but there seems to be a bug. All of the smartart items I have created in my document are cropped along the bottom edge, some more so than others. I, of course, have not intentionally cropped these items. And according to Microsoft's online help, the only way to crop Smartart is to convert it to clip art, then use Word's cropping tools on the clip art, which is what makes me believe this is a bug. Has anyone else encountered this problem, and is there a way to fix it?

    Read the article

  • Problem in cropping the UIImage using CGContext?

    - by Rajendra Bhole
    Hi, I developing the simple UIApplication in which i want to crop the UIImage (in .jpg format) with help of CGContext. The developed code till now as follows, CGImageRef graphicOriginalImage = [originalImage.image CGImage]; UIGraphicsBeginImageContext(originalImage.image.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGBitmapContextCreateImage(graphicOriginalImage); CGFloat fltW = originalImage.image.size.width; CGFloat fltH = originalImage.image.size.height; CGFloat X = round(fltW/4); CGFloat Y =round(fltH/4); CGFloat width = round(X + (fltW/2)); CGFloat height = round(Y + (fltH/2)); CGContextTranslateCTM(ctx, 0, image.size.height); CGContextScaleCTM(ctx, 1.0, -1.0); CGRect rect = CGRectMake(X,Y ,width ,height); CGContextDrawImage(ctx, rect, graphicOriginalImage); croppedImage = UIGraphicsGetImageFromCurrentImageContext(); return croppedImage; } The above code is worked fine but it can't crop image. The original image memory and cropped image memory i will got same(equal to original image memory). The above code is right for cropping the image?????????????????? How i cropping the image (in behind pixels should also be crop) from the center of the image???????????? I already wasting a lot of time for developing the above code , but i didn't get answer or way to find out how to crop the image.Thanks for sending me answer in advanced.

    Read the article

  • Prevent image cropping when making sprites from gif

    - by OSaad
    Hey guys I've tried several tools (imagemagic, gif2png, Nconverter) to extract frames to make sprites from a .gif image that i have. I get the .pngs just fine, but they'r not the same size, some are 50x65 some 43x65 some 50x70, Which really screws any attempts at a descent animation. So is there a way to prevent this cropping or programmatically add extra transparent space to smaller ones and make them all the same size? Thanks.

    Read the article

  • Cropping a PDF File's Margin During Printing

    - by JavaMan
    I'm using the free Acrobat Reader to print out some pdf documents having very large top/bottom/left/right margins. I want to remove the margins (which are wasting too much space and making the fonts too small). I used to use Acrobat (the paid version having edit features) to crop the src pdf file manually. But since it is an old version it does not support new pdf format and I don't want to upgrade for such a simple use. Is there any free way to crop/remove unwanted white margins from the printed pdf? I am thinking to print the pdf files to a PDF Printer like the Bullzip PDF Printer and enlarge the output file manually so as to remove any white margin. But there does not seem to be such a feature in Bullzip PDF Printer. Is there any other virtual printer software that can be used for this purpose?

    Read the article

  • Free MPEG cutting/cropping/editing tool

    - by Stijn Sanders
    I'm looking for a free tool to cut MPEG's that are created by recording from a USB cable receiver. There are a number of applications that do this, and some are free, but most of them take the video and audio decoded and pass them into a codec again to write the final output. I already have the MPEG's encoded the way I like, so what I need is a tool that can strip the beginning and the ending of the recording before and optionally commercial breaks, by rearranging the data within the file, not re-encoding it. Now I'm using some old software that came with the cable-receiver, but this actually re-encodes the video when exporting. I've tried VirtualDub but had major trouble getting the audio and video streams to stay in sync (and this was also re-encoding)... I found this which comes pretty close, but doesn't allow much accuracy in selecting cut positions.

    Read the article

  • Mac OS X Photo Tool: Cropping w/ particular aspect ratio

    - by Jason S
    I'm spoiled by FastStone on the PC. I'm looking for decent freeware/shareware for Mac OS X that will allow basic photo editing, particularly something that lets me pick a crop size or aspect ratio by entering in numbers rather than just a freehand crop (I need to make sure it's 8.5"x11" aspect ratio). Any suggestions?

    Read the article

  • How do I stop cropping in iMovie?

    - by Javoid
    I'm not certain if 'crop' is the right term. I'm new to iMovie so I may have some of the terminology wrong. When I import a movie, I allow it to resize to the recommended settings instead of full size. Then I drag it from the lower event pane into the project pane. In the 'preview' pane where the movie can be played, the top and bottom of the movie are cut off a little. It's like its converting it to widescreen by cutting off the top and bottom. After I publish the movie in mobile format (it won't allow any larger) it still has the top and bottom removed. How can I stop this? I even tried importing full (original) size and it still didn't help.

    Read the article

  • Real-time Image Resize, Cropping and Caching Server Product

    - by Elijah
    I'm investigating what products are out there that will allow you to request images through a HTTP API in arbitrary image sizes. The server would behind a CDN but would still need to be able to handle a fair bit of traffic and be possibly load-balanced. I've been tasked with writing such a service, but I wanted to do some due diligence to see what commercial or open source solutions are out there. Google has not been particularly helpful. It may be because I have been searching for the wrong term. Third-party sites and services are out of the question because of corporate policies.

    Read the article

  • BlackBerry - Cropping image

    - by rupesh
    Hi all i want to crop a part of Image ,for that i am using following code: int x=20; int y=50; int [] rgbdata=new int[(0+width-x+height-y)* (image.getWidth())]; image.getARGB(rgbdata, 0, image.getWidth(), x, y, width, height); cropedImage=new Bitmap(image.getWidth(),image.getWidth()); cropedImage.setARGB(rgbdata, 0,image.getWidth(), 80,80, width, height); x an y are the position from where the cropping will be done in the rectangular form. but it is not working can any one help me out please. any sample code will work for me. its urgent. thanks in advance

    Read the article

  • QGraphicsView scrolling and image scaling/cropping

    - by boohoo
    I would like to have a background image in my QGraphicsView that is always scaled (and cropped if necessary) to the size of the viewport, without scrollbars and without scrolling with the keyboard and mouse. The example below is what I am doing to scale and crop an image in the viewport, but I am using random values for the cropping that are pulled out of the aether. I would like a logical solution? MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); scene = new QGraphicsScene(this); ui->graphicsView->resize(800, 427); // MainWindow is 800x480, GraphicsView is 800x427. I want an image that // is the size of the graphicsView. ui->graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // the graphicsView still scrolls if the image is too large, but // displays no scrollbars. I would like it not to scroll (I want to // add a scrolling widget into the QGraphicsScene later, on top of // the background image.) QPixmap *backgroundPixmap = new QPixmap(":/Valentino_Bar_Prague.jpg"); QPixmap sized = backgroundPixmap->scaled( QSize(ui->graphicsView->width(), ui->graphicsView->height()), Qt::KeepAspectRatioByExpanding); // This scales the image too tall QImage sizedImage = QImage(sized.toImage()); QImage sizedCroppedImage = QImage(sizedImage.copy(0,0, (ui->graphicsView->width() - 1.5), (ui->graphicsView->height() + 19))); // so I try to crop using copy(), and I have to use these values // and I am unsure why. QGraphicsPixmapItem *sizedBackground = scene->addPixmap( QPixmap::fromImage(sizedCroppedImage)); sizedBackground->setZValue(1); ui->graphicsView->setScene(this->scene); } I would like to know a way to scale and crop an image to the size of the QGraphicsView that will work even when I resize the QGraphicsView. Where are the 1.5 and 19 coming from?

    Read the article

  • Rotating an Image in Silverlight without cropping

    - by Tim Saunders
    I am currently working on a simple Silverlight app that will allow people to upload an image, crop, resize and rotate it and then load it via a webservice to a CMS. Cropping and resizing is done, however rotation is causing some problems. The image gets cropped and is off centre after the rotation. WriteableBitmap wb = new WriteableBitmap(destWidth, destHeight); RotateTransform rt = new RotateTransform(); rt.Angle = 90; rt.CenterX = width/2; rt.CenterY = height/2; //Draw to the Writeable Bitmap Image tempImage2 = new Image(); tempImage2.Width = width; tempImage2.Height = height; tempImage2.Source = rawImage; wb.Render(tempImage2,rt); wb.Invalidate(); rawImage = wb; message.Text = "h:" + rawImage.PixelHeight.ToString(); message.Text += ":w:" + rawImage.PixelWidth.ToString(); //Finally set the Image back MyImage.Source = wb; MyImage.Width = destWidth; MyImage.Height = destHeight; The code above only needs to rotate by 90° at this time so I'm just setting destWidth and destHeight to the height and width of the original image.

    Read the article

  • PHP/GD - Cropping and Resizing Images

    - by Alix Axel
    I've coded a function that crops an image to a given aspect ratio and finally then resizes it and outputs it as JPG: <?php function Image($image, $crop = null, $size = null) { $image = ImageCreateFromString(file_get_contents($image)); if (is_resource($image) === true) { $x = 0; $y = 0; $width = imagesx($image); $height = imagesy($image); /* CROP (Aspect Ratio) Section */ if (is_null($crop) === true) { $crop = array($width, $height); } else { $crop = array_filter(explode(':', $crop)); if (empty($crop) === true) { $crop = array($width, $height); } else { if ((empty($crop[0]) === true) || (is_numeric($crop[0]) === false)) { $crop[0] = $crop[1]; } else if ((empty($crop[1]) === true) || (is_numeric($crop[1]) === false)) { $crop[1] = $crop[0]; } } $ratio = array ( 0 => $width / $height, 1 => $crop[0] / $crop[1], ); if ($ratio[0] > $ratio[1]) { $width = $height * $ratio[1]; $x = (imagesx($image) - $width) / 2; } else if ($ratio[0] < $ratio[1]) { $height = $width / $ratio[1]; $y = (imagesy($image) - $height) / 2; } /* How can I skip (join) this operation with the one in the Resize Section? */ $result = ImageCreateTrueColor($width, $height); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, false); ImageFill($result, 0, 0, ImageColorAllocateAlpha($result, 255, 255, 255, 127)); ImageCopyResampled($result, $image, 0, 0, $x, $y, $width, $height, $width, $height); $image = $result; } } /* Resize Section */ if (is_null($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { $size = array_filter(explode('x', $size)); if (empty($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { if ((empty($size[0]) === true) || (is_numeric($size[0]) === false)) { $size[0] = round($size[1] * imagesx($image) / imagesy($image)); } else if ((empty($size[1]) === true) || (is_numeric($size[1]) === false)) { $size[1] = round($size[0] * imagesy($image) / imagesx($image)); } } } $result = ImageCreateTrueColor($size[0], $size[1]); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, true); ImageFill($result, 0, 0, ImageColorAllocate($result, 255, 255, 255)); ImageCopyResampled($result, $image, 0, 0, 0, 0, $size[0], $size[1], imagesx($image), imagesy($image)); header('Content-Type: image/jpeg'); ImageInterlace($result, true); ImageJPEG($result, null, 90); } } return false; } ?> The function works as expected but I'm creating a non-required GD image resource, how can I fix it? I've tried joining both calls but I must be doing some miscalculations. <?php /* Usage Examples */ Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '1:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:', '250x300'); ?> Any help is greatly appreciated, thanks.

    Read the article

1 2 3 4 5 6 7  | Next Page >