Search Results

Search found 38856 results on 1555 pages for 'image process'.

Page 48/1555 | < Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >

  • Resizing and saving an image in WinMobile and .NET CF throws OutOfMemoryException

    - by devguy
    I have a WinMobile app which allows the user the snap a photo with the camera, and then use for for various things. The photo can be snapped at 1600x1200, 800x600 or 640x480, but it must always be resized to 400px for the longest size (the other is proportional of course). Here's the code: private void LoadImage(string path) { Image tmpPhoto = new Bitmap(path); // calculate new bitmap size... double width = ... double height = ... // draw new bitmap Image photo = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); using (Graphics g = Graphics.FromImage(photo)) { g.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, photo.Width, photo.Height)); int srcX = (int)((double)(tmpPhoto.Width - width) / 2d); int srcY = (int)((double)(tmpPhoto.Height - height) / 2d); g.DrawImage(tmpPhoto, new Rectangle(0, 0, photo.Width, photo.Height), new Rectangle(srcX, srcY, photo.Width, photo.Height), GraphicsUnit.Pixel); } tmpPhoto.Dispose(); // save new image and dispose photo.Save(Path.Combine(config.TempPath, config.TempPhotoFileName), System.Drawing.Imaging.ImageFormat.Jpeg); photo.Dispose(); } Now the problem is that the app breaks in the photo.Save call, with an OutOfMemoryException. And I don't know why, since I dispose the tempPhoto (with the original photo from the camera) as soon as I can, and I also dispose the Graphics obj. Why does this happen? It seems impossible to me that one can't take a photo with the camera and resize/save it without making it crash :( Should I restor t C++ for such a simple thing? Thanks.

    Read the article

  • Upload image from J2ME client to a Servlet

    - by Akash
    I want to send an image from a J2ME client to a Servlet. I am able to get a byte array of the image and send it using HTTP POST. conn = (HttpConnection) Connector.open(url, Connector.READ_WRITE, true); conn.setRequestMethod(HttpConnection.POST); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); os.write(bytes, 0, bytes.length); // bytes = byte array of image This is the Servlet code: String line; BufferedReader r1 = new BufferedReader(new InputStreamReader(in)); while ((line = r1.readLine()) != null) { System.out.println("line=" + line); buf.append(line); } String s = buf.toString(); byte[] img_byte = s.getBytes(); But the problem I found is, when I send bytes from the J2ME client, some bytes are lost. Their values are 0A and 0D hex. Exactly, the Carriage Return and Line Feed. Thus, either POST method or readLine() are not able to accept 0A and 0D values. Any one have any idea how to do this, or how to use any another method?

    Read the article

  • Two Way Data Binding With a Object in WPF,Image Control

    - by Candy
    Sorry, my English is not very good, I have a object "Stuffs" "Stuffs" have a Property “Icon” now: xaml <Button Click="Button_Click"><Image Width="80" Height="80" Source="{Binding Path=Icon,Converter={StaticResource ImageConverter}}"/></Button> cs private void Button_Click(object sender, RoutedEventArgs e) { IconFloder.Title = "Icon"; String IconFloderPath = AppDomain.CurrentDomain.BaseDirectory + ItemIconFloder; if (!System.IO.Directory.Exists(IconFloderPath)) System.IO.Directory.CreateDirectory(IconFloderPath); IconFloder.InitialDirectory = IconFloderPath; IconFloder.Filter = "Image File|*.jpeg"; IconFloder.ValidateNames = true; IconFloder.CheckPathExists = true; IconFloder.CheckFileExists = true; if (IconFloder.ShowDialog() == true) { HideImage.Text = ItemIconFloder + "\\" + IconFloder.SafeFileName; ((sender as Button).Content as Image).Source = new ImageConverter().Convert(ItemIconFloder + "\\" + IconFloder.SafeFileName, Type.GetType("System.Windows.Media.ImageSource"), null, new System.Globalization.CultureInfo("en-US")) as ImageSource; } } class ImageConverter:IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is string&&!String.IsNullOrEmpty(value.ToString())) { try { return new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + value)); } catch { } } return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } I would like to click buttons, change the picture, Also change Data Binding Stuffs.Icon But failed,I have no idea?I need help? I do not know whether I speak clearly

    Read the article

  • Optimizing code using PIL

    - by freakazo
    Firstly sorry for the long piece of code pasted below. This is my first time actually having to worry about performance of an application so I haven't really ever worried about performance. This piece of code pretty much searches for an image inside another image, it takes 30 seconds to run on my computer, converting the images to greyscale and other changes shaved of 15 seconds, I need another 15 shaved off. I did read a bunch of pages and looked at examples but I couldn't find the same problems in my code. So any help would be greatly appreciated. From the looks of it (cProfile) 25 seconds is spent within the Image module, and only 5 seconds in my code. from PIL import Image import os, ImageGrab, pdb, time, win32api, win32con import cProfile def GetImage(name): name = name + '.bmp' try: print(os.path.join(os.getcwd(),"Images",name)) image = Image.open(os.path.join(os.getcwd(),"Images",name)) except: print('error opening image;', name) return image def Find(name): image = GetImage(name) imagebbox = image.getbbox() screen = ImageGrab.grab() #screen = Image.open(os.path.join(os.getcwd(),"Images","Untitled.bmp")) YLimit = screen.getbbox()[3] - imagebbox[3] XLimit = screen.getbbox()[2] - imagebbox[2] image = image.convert("L") Screen = screen.convert("L") Screen.load() image.load() #print(XLimit, YLimit) Found = False image = image.getdata() for y in range(0,YLimit): for x in range(0,XLimit): BoxCoordinates = x, y, x+imagebbox[2], y+imagebbox[3] ScreenGrab = screen.crop(BoxCoordinates) ScreenGrab = ScreenGrab.getdata() if image == ScreenGrab: Found = True #print("woop") return x,y if Found == False: return "Not Found" cProfile.run('print(Find("Login"))')

    Read the article

  • Image Wells, Core Data, and Sqlite files.

    - by Sway
    I've got a mac application that I've developed. I use it to create sqlite files that are bundled with my iphone app. The mac app uses Core Data and bindings and is working fine except for one "weird" issue. I use an NSImageView (or Image Well) to allow me to drag and drop jpg files. This is bound through to an optional binary attribute in my model class. For some reason when I drag and drop a 4k jpg file it onto the image well and save the sqlite file. The data saved to the binary column is over 15 times larger than it should be. Whereas if I use an application like SQLiteManager and add the image into the row in the database. The binary data is the correct (expected size). File 4k jpg Actual size: 2371. Persisted via Core Data size: 35810. Can anyone give me a suggestion as to why this might be happening? Do I need to set some setting in Interface Builder or write some custom code?

    Read the article

  • Get remote image using cURL then resample.

    - by Chris
    I want to be able to retrieve a remote image from a webserver, resample it, and then serve it up to the browser AND save it to a file. Here is what I have so far: $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "$rURL"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // grab URL and pass it to the browser $out = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); $imgRes = imagecreatefromstring($out); imagejpeg($imgRes, $filename, 70); header("Content-Type: image/jpg"); header("Content-length: ".filesize($filename)); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); Update Updated code to include imjpeg step to save the image as lower quality. But how do I then, efficiently, serve this up to the browser. I currently, later in the code, do this readfile("$filename"); along with some header information but that means I'm reading the file back in again which seems inefficient.

    Read the article

  • Flex 3 - Saving an image of a component

    - by Emma
    Im currently trying to work the imageSnapshot function in flex. Ive been looking hard but I cant seem to find a solution to my problem. I wish to take a screenshot of one of my components, to capture the final output of my program, since a plain "printscreen" cuts off some of the output due to it scrolling. My current code looks like - <mx:ApplicationControlBar dock="true"> <mx:Button label="Take snapshot of Profile" click="takeSnapshot();" /> </mx:ApplicationControlBar> Which when called does - private function takeSnapshot(even:Event=null):void { var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(viewstack1); Now i think this is taking the image of the viewstack which I want... But Im stumped on what to do from here! Is it not possible to now just copy the image to the clipboard, or produce a new window in my browser with the entire image inside? If anyone has any other way to do this, suggestions would be wonderful. Thank you for your time.

    Read the article

  • iPhone OS: Strategies for high density image work

    - by Jasconius
    I have a project that is coming around the bend this summer that is going to involve, potentially, an extremely high volume of image data for display. We are talking hundreds of 640x480-ish images in a given application session (scaled to a smaller resolution when displayed), and handfuls of very large (1280x1024 or higher) images at a time. I've already done some preliminary work and I've found that the typical 640x480ish image is just a shade under 1MB in memory when placed into a UIImageView and displayed... but the very large images can be a whopping 5+ MB's in some cases. This project is actually be targeted at the iPad, which, in my Instruments tests seems to cap out at about 80-100MB's of addressable physical memory. Details aside, I need to start thinking of how to move huge volumes of image data between virtual and physical memory while preserving the fluidity and responsiveness of the application, which will be high visibility. I'm probably on the higher ends of intermediate at Objective-C... so I am looking for some solid articles and advice on the following: 1) Responsible management of UIImage and UIImageView in the name of conserving physical RAM 2) Merits of using CGImage over UIImage, particularly for the huge images, and if there will be any performance gain 3) Anything dealing with memory paging particularly as it pertains to images I will epilogue by saying that the numbers I have above maybe off by about 10 or 15%. Images may or may not end up being bundled into the actual app itself as opposed to being loaded in from an external server.

    Read the article

  • Resize image while rotating image in android

    - by dhams
    Hi every one ,,m working with android project in which i want to rotate image along with touch to some fix pivot point ,,,i have completed all the things but i have facing one problem ,,,while m trying to rotate image the image bitmap is resize....i dont have any idea why it occur ....if somebody have den please give me idea to come over this problem.... my code is below ..... package com.demo.rotation; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ImageView; import android.widget.ImageView.ScaleType; public class temp extends Activity{ ImageView img1; float startX; float startX2 ; Bitmap source; Bitmap bitmap1 = null; double r; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); img1 = (ImageView) findViewById(R.id.img1); img1.setOnTouchListener(img1TouchListener); bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.orsl_circle_transparent); } private OnTouchListener img1TouchListener = new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: Log.d("MOVE", "1"); if(source!=null) r = Math.atan2(event.getX() - source.getWidth(), (source.getHeight() / 2) - event.getY()); Log.i("startX" + event.getX(), "startY" + event.getY()); rotate(r,bitmap1, img1); img1.setScaleType(ScaleType.CENTER); break; case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: break; default : break; } return true; } }; private void rotate(double r , Bitmap currentBitmap ,ImageView imageView ) { int rotation = (int) Math.toDegrees(r); Matrix matrix = new Matrix(); matrix.setRotate(rotation, currentBitmap.getWidth()/2, currentBitmap.getHeight()/2); source = Bitmap.createBitmap(currentBitmap, 0, 0, currentBitmap.getWidth(), currentBitmap.getHeight(), matrix, false); imageView.setImageBitmap(source); Log.i("HIGHT OF CURRENT BITMAP", ""+source.getHeight()); } }

    Read the article

  • Image processing on bifurcation diagram to get small eps size

    - by yCalleecharan
    Hello, I'm producing bifurcation diagrams (which are normally used in nonlinear dynamics). These diagrams identify abrupt changes in topologies due to stability changes. These abrupt changes occur as one or more parameters pass through some critical value(s). An example is here: http://en.wikipedia.org/wiki/File:LogisticMap_BifurcationDiagram.png On the above figure, some image processing has been done so as to make the plot more visually pleasant. A bifurcation diagram usually contains hundreds of thousands of points and the resulting eps file can become very big. Journal submission in the LaTeX format require that figures are to be submitted in the eps format. In my case one of such figures can result in about 6 MB in Matlab and even much more in Gnuplot. For the example in the above figure, 100,000 x values are calculated for each r and one can imagine that the resulting eps file would be huge. The site however explains some image processing that makes the plot more visually pleasing. Can anyone explain to me stepwise how go about? I can't understand the explanation provided in the "summary" section. Will the resulting image processing also reduce the figure size? Furthermore, any tips on reducing the file size of such a huge eps figure? Thanks a lot...

    Read the article

  • SVG <image> doesn't work in <defs> on Chrome

    - by avladev
    I want to use image in a group definded in defs tag. But on Chrome nothing works. In Firefox only the .png file is displayd. Only Rectangle apears but with strange bug in Chrome. Is this is supported by SVG or im not using it right. plane.svg <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg baseProfile="full" width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <defs> <g id="car"> <rect x="0" y="0" width="30" height="30" fill="#ff0000" /> <image xlink:href="items/car.svg" x="0" y="0" width="30" height="30" /> <image xlink:href="items/t6k.png" x="100" y="100" width="140" height="140" /> </g> </defs> <use xlink:href="#car" x="0" y="0" width="600" height="600" /> </svg> images/car.svg <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg baseProfile="full" width="30" height="30" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> <rect x="0" y="0" width="30" height="30" fill="red" stroke="green" stroke-width="3"/> </svg> Download code: http://www.4shared.com/file/9gNi5gCO/svg_bug.html

    Read the article

  • Fetch image from folder via datatable does not work after placing image in subdirectory

    - by Arnold Bishkoff
    I am having trouble wrapping my head around the following I have code that fetches an image via smarty in a line img src="getsnap.php?picid={$data[$smarty.section.sec.index].picno|default:$nextpic}&typ=pic&width={$config.disp_snap_width}&height={$config.disp_snap_height}" class="smallpic" alt="" / this works if i pull the image from /temp/userimages/userid/imageNo.ext but because an OS can segfault if you store too many folders or images in a directory i have code that assigns the user image to a subdirectory based upon division of a subdir per 1000 userids. so in thise case i have user id 94 whos images get stored in /siteroot/temp/userimages/000000/94/pic_1.jpg (through 10) or tn_1 (through 10).jpg here is the code for getsnap.php <?php ob_start(); if ( !defined( 'SMARTY_DIR' ) ) { include_once( 'init.php' ); } include('core/snaps_functions.php'); if (isset($_REQUEST['username']) && $_REQUEST['username'] != '') { $userid = $osDB-getOne('select id from ! where username = ?',array(USER_TABLE, $_REQUEST['username']) ); } else { // include ( 'sessioninc.php' ); if( !isset($_GET['id']) || (isset($_GET['id'])&& (int)$_GET['id'] <= 0 ) ) { $userid = $_SESSION['UserId']; } else { $userid = $_GET['id']; } } if (!isset($_GET['picid']) ) { if ((isset($_REQUEST['type']) && $_REQUEST['type'] != 'gallery') || !isset($_REQUEST['type']) ) { $defpic = $osDB-getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and default_pic = ? and active = ? ',array(USER_SNAP_TABLE, $userid,'0','Y','Y' ) ); if ($defpic != '') { $picid = $defpic; } else { $picid = $osDB-getOne('select picno from ! where userid = ? and ( album_id is null or album_id = ?) and active=? order by rand()',array(USER_SNAP_TABLE, $userid,'0','Y' ) ); } unset( $defpic); } } else { $picid = $_GET['picid']; } $typ = isset( $_GET['typ'])?$_GET['typ']:'pic' ; $cond = ''; if ( ($config['snaps_require_approval'] == 'Y' || $config['snaps_require_approval'] == '1') && $userid != $_SESSION['UserId'] ) { $cond = " and active = 'Y' "; } $sql = 'select * from ! where userid = ? and picno = ? '.$cond; //Get the pic $row =& $osDB-getRow ( $sql, array( USER_SNAP_TABLE, $userid, $picid ) ); //Okay pic was found in the DB, Lets actually do something // $id = $userid; $dir = str_pad(($id - ($id % 1000))/100000,6,'0',STR_PAD_LEFT); $zimg = USER_IMAGES_DIR.$dir; $img = getPicture($zimg, $userid, $picid, $typ, $row); //$img = getPicture($userid, $picid, $typ, $row); //$img = getPicture($dir, $userid, $picid, $typ, $row); $ext = ($typ = 'tn')?$row['tnext']:$row['picext']; // Now pic is built as // something pic_x.ext ie pic_2.jpg if ( $img != '' && ( ( hasRight('seepictureprofile') && ( $config['snaps_require_approval'] == 'Y' && $row['active'] == 'Y' ) ||$config['snaps_require_approval'] == 'N' ) || $userid == $_SESSION['UserId'] ) ) { $img2 = $img; //$img2 = $dir.'/'.$img; } else { $gender = $osDB-getOne( 'select gender from ! where id = ?', array( USER_TABLE, $userid ) ) ; if ($gender == 'M') { $nopic = SKIN_IMAGES_DIR.'male.jpg'; } elseif ($gender == 'F') { $nopic = SKIN_IMAGES_DIR.'female.jpg'; } elseif ($gender == 'D') { $nopic = SKIN_IMAGES_DIR.'director.jpg'; } $img2 = imagecreatefromjpeg($nopic); $ext = 'jpg'; } ob_end_clean(); header("Pragma: public"); header("Content-Type: image/".$ext); header("Content-Transfer-Encoding: binary"); header("Cache-Control: must-revalidate"); $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() - 30) . " GMT"; header($ExpStr); $id = $userid; $dir = str_pad(($id - ($id % 1000))/100000,6,'0',STR_PAD_LEFT); $zimg = USER_IMAGES_DIR.$dir; //header("Content-Disposition: attachment; filename=profile_".$userid."_".$typ.".".$ext); //header("Content-Disposition: attachment; filename=$dir.'/'.profile_".$userid."".$typ.".".$ext); //header("Content-Disposition: attachment; filename=profile"$dir".'/'.".$userid."_".$typ.".".$ext); header("Content-Disposition: attachment; filename=profile_".$userid."_".$typ.".".$ext); /* if ($_SESSION['browser'] != 'MSIE') { header("Content-Disposition: inline" ); } */ if ($ext == 'jpg') { imagejpeg($img2); } elseif ($ext == 'gif') { imagegif($img2); } elseif ($ext == 'png') { imagepng($img2); } elseif ($ext == 'bmp') { imagewbmp($img2); } imagedestroy($img2); ?

    Read the article

  • Changing RGB color image to Grayscale image using Objective C

    - by user567167
    I was developing a application that changes color image to gray image. However, some how the picture comes out wrong. I dont know what is wrong with the code. maybe the parameter that i put in is wrong please help. UIImage *c = [UIImage imageNamed:@"downRed.png"]; CGImageRef cRef = CGImageRetain(c.CGImage); NSData* pixelData = (NSData*) CGDataProviderCopyData(CGImageGetDataProvider(cRef)); size_t w = CGImageGetWidth(cRef); size_t h = CGImageGetHeight(cRef); unsigned char* pixelBytes = (unsigned char *)[pixelData bytes]; unsigned char* greyPixelData = (unsigned char*) malloc(w*h); for (int y = 0; y < h; y++) { for(int x = 0; x < w; x++){ int iter = 4*(w*y+x); int red = pixe lBytes[iter]; int green = pixelBytes[iter+1]; int blue = pixelBytes[iter+2]; greyPixelData[w*y+x] = (unsigned char)(red*0.3 + green*0.59+ blue*0.11); int value = greyPixelData[w*y+x]; } } CFDataRef imgData = CFDataCreate(NULL, greyPixelData, w*h); CGDataProviderRef imgDataProvider = CGDataProviderCreateWithCFData(imgData); size_t width = CGImageGetWidth(cRef); size_t height = CGImageGetHeight(cRef); size_t bitsPerComponent = 8; size_t bitsPerPixel = 8; size_t bytesPerRow = CGImageGetWidth(cRef); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGBitmapInfo info = kCGImageAlphaNone; CGFloat *decode = NULL; BOOL shouldInteroplate = NO; CGColorRenderingIntent intent = kCGRenderingIntentDefault; CGDataProviderRelease(imgDataProvider); CGImageRef throughCGImage = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, info, imgDataProvider, decode, shouldInteroplate, intent); UIImage* newImage = [UIImage imageWithCGImage:throughCGImage]; CGImageRelease(throughCGImage); newImageView.image = newImage;

    Read the article

  • Wrapper background image gets cut off at the top

    - by dq7133
    My site has a wrapper with three background images. A static top and bottom image and a third image that repeats along the y axis. For some reason the top background image is getting cut off and I can't figure out way. Here is a link to the live site: http://storrepictures.weebly.com/projects.html I have offset the top and bottom images so you can see what they look like. You can see that the top one is cut off. I've tried messing around with some of the div padding settings but can't seem to get it to work. One interesting note: The background images used to be JPEGs (I switched to PNG files because I needed transparency). When I was using JPEGs this was not a problem - the three images lined up perfectly. Let me know if it would help to have the actual code posted. From what I've been reading on this forum, people seem to like looking at the live site and I didn't want to make the post too long. Thanks a lot for all your help.

    Read the article

  • How do I show and position an Image initialized in the codebehind on my page?

    - by Andreas Strandfelt
    Hello. I have created a simple method to check if an image has been approved and finally returns it as an control. But how do i call and show it on the page? I've tried something like this in the aspx-file: <% SendImage("DKBygMiniLogo.gif", "True"); %> Here is the simple method: protected Image SendImage(object Image, object Approved) { bool approved = Convert.ToBoolean(Approved); Image img = new Image(); if (approved) { img.ImageUrl = "~/images/Ads/" + Image.ToString(); img.Visible = true; } else { img.ImageUrl = "~/images/Ads/" + Image.ToString(); img.Visible = false; } return img; } How do I actually show the image?

    Read the article

  • jQuery - Toggle CSS Background Image Expand/Close

    - by urbanrunic
    I am looking for a way to change the back ground image on toggle as in this questions here: jQuery - Toggle Image Expand/Close My issue is I have this html: <button id="close-menu"></button> <div id="menu-bar"> <div class="wrapper"> <a href="http://www.website.com" target="_blank"> <img src="image.png" alt=""> </a> <div class="options"> <h2>eBlast Tools</h2> <ul> <li class="toggle-images">Images are <span>enabled</span>. Click to disable.</li> <li class="download-zip"><a href="download.zip">Download ZIP File</a></li> </ul> </div> </div> </div> and this is my current jquery: $('#close-menu').click(function() { $('#menu-bar').slideToggle(400); return false; }); and this is the css: #close-menu { background: url(../img/minus-button.png); background-position: top left; width: 25px; height: 25px; position: absolute; top: 10px; right: 20px; z-index: 100; border: none; } #close-menu:hover { background: url(../img/minus-button.png); background-position: bottom left; }

    Read the article

  • How can I overlay a watermark on an already resampled image in PHP (using GD) ?

    - by Rick
    Here's my current code: define('IMG_WIDTH', (isset ($_GET['width'])) ? (int) $_GET['width'] : 99); define('IMG_HEIGHT', (isset ($_GET['height'])) ? (int) $_GET['height'] : 75); $image = imagecreatefromjpeg($_GET['image']); $origWidth = imagesx($image); $origHeight = imagesy($image); $croppedThumb = imagecreatetruecolor(IMG_WIDTH, IMG_HEIGHT); if ($origWidth > $origHeight) { $leftOffset = ($origWidth - $origHeight) / 2; imagecopyresampled($croppedThumb, $image, 0, 0, $leftOffset, 0, IMG_WIDTH, IMG_HEIGHT, $origHeight, $origHeight); } else { $topOffset = ($origHeight - $origWidth) / 2; imagecopyresampled($croppedThumb, $image, 0, 0, 0, $topOffset, IMG_WIDTH, IMG_HEIGHT, $origWidth, $origWidth); } It basically takes an image and re-sizes it to create a thumbnail. It works quite nicely. What I would like to do now is add a watermark to the bottom right corner. I've seen the imagecopymerge function used for this... However, that doesn't seem to allow me to supply a resampled image as the source. How can I take my already modified image and add a watermark? :/ I've thought of saving the image to /tmp and then unlink()'ing it once I've added the watermark but that seems like a bit of a mess...

    Read the article

  • Image Gurus: Optimize my Python PNG transparency function

    - by ozone
    I need to replace all the white(ish) pixels in a PNG image with alpha transparency. I'm using Python in AppEngine and so do not have access to libraries like PIL, imagemagick etc. AppEngine does have an image library, but is pitched mainly at image resizing. I found the excellent little pyPNG module and managed to knock up a little function that does what I need: make_transparent.py pseudo-code for the main loop would be something like: for each pixel: if pixel looks "quite white": set pixel values to transparent otherwise: keep existing pixel values and (assuming 8bit values) "quite white" would be: where each r,g,b value is greater than "240" AND each r,g,b value is within "20" of each other This is the first time I've worked with raw pixel data in this way, and although works, it also performs extremely poorly. It seems like there must be a more efficient way of processing the data without iterating over each pixel in this manner? (Matrices?) I was hoping someone with more experience in dealing with these things might be able to point out some of my more obvious mistakes/improvements in my algorithm. Thanks!

    Read the article

  • How To Create A Link For "save Image As" To Download an Image In Rails

    - by Kuya
    I want to make a link download like this http://idwallpaper.com/download.php?image_id=1517 I have tried on other tutorial like this <script> function SaveFile(fname){ img.document.execCommand('saveas', null ,fname) } </script> <iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0px"></iframe> <button onclick="SaveFile('myimage.jpg');">save as</button> Does not work in FireFox though.....

    Read the article

  • add/delete image ID to/from textbox when image clicked

    - by Huseyin
    I am working on a simple news module. There is a form where user adds multiple image IDs to one textbox then submits it. To improve the usability, I listed all the images they can add (ID numbers displayed next to it) on one side. However, this still is little bit confusing. I want image IDs added/deleted to the textbox when user clicks on the images. Spare me codes, methods, ideas, examples... I will take anything.

    Read the article

  • display text when image on-click/hide text when different image click

    - by Jonah1289
    Hi I have created the following effects on the images seen here http://techavid.com/design/test3.html . You see when you hover and then click on each image, they go from grey to color. When you click on one - the others go grey and the one clicked remains color. That's cool, but now I need the text 1st: Sun for example to display and hide along with its graphic button. The word "Sun," is a link that needs to link out to a URL so it has to be separated from the image effect code. What jquery or javascript code do I need to do this? thanks, jonah p.s. How do i properly post the code I have now. I tried to paste code in "enter code here," but received errors - thnx

    Read the article

  • Post valuse and upload Image to php server in android

    - by lawat
    I am trying to upload image from android phone to php server with additional values,the method is post my php file look like this if($_POST['val1']){ if($_POST['val2']){ if($_FILE['image']){ ...... } } }else{ echo "Value not found"; } I am doing is URL url=new URL("http://www/......../myfile.php"); HttpURLConnection con=(HttpURLConnection) url.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestMethod("POST");//Enable http POST con.setRequestProperty("Connection", "Keep-Alive"); con.setRequestProperty("Content-Type", "multipart/form-data;boundary="+"****"); connection.setRequestProperty("uploaded_file", imagefilePath); DataOutputStream ostream = new DataOutputStream( con.getOutputStream()); String res=("Content-Disposition: form-data; name=\"val1\""+val1+"****"+ "Content-Disposition: form-data; name=\"val2\""+val2+"****" "Content-Disposition: form-data; name=\"image\";filename=\"" + imagefilePath +"\""+"****"); outputStream.writeBytes(res); my actual problem is values are not posting so first if condition get false and else section is executed that is it give value not found please help me

    Read the article

  • Android How do you save an image with your own unique Image Name?

    - by Usmaan
    This sounds like a issue a beginner like me would only have...this is my code... private void saveAvatar(Bitmap avatar) { String strAvatarFilename = Id + ".jpg"; try { avatar.compress(CompressFormat.JPEG, 100, openFileOutput(strAvatarFilename, MODE_PRIVATE)); } catch (Exception e) { Log.e(DEBUG_TAG, "Avatar compression and save failed.", e); } Uri imageUriToSaveCameraImageTo = Uri.fromFile(new File(PhotoActivity.this.getFilesDir(), strAvatarFilename)); Editor editor = Preferences.edit(); editor.putString(PREFERENCES_AVATAR, imageUriToSaveCameraImageTo.getPath()); editor.commit(); ImageButton avatarButton = (ImageButton) findViewById(R.id.ImageButton_Avatar); String strAvatarUri = Preferences.getString(PREFERENCES_AVATAR, ""); Uri imageUri = Uri.parse(strAvatarUri); avatarButton.setImageURI(null); avatarButton.setImageURI(imageUri); } This does save the image but when i go to look at the image on the sd card ti is called imag001 etc not the ID i am labelling it. How do i save the image with a name i want to call it? regards

    Read the article

  • Image is not displaying in email template on 2nd time forward

    - by Don
    Good day Friends, I've a mass mailing program with simple mail templates (HTML and few Images). I've a problem with image display. My clients are not getting images in the mail. Sometimes they get a mail with all the images, But if they forward the same email to someone else, they can’t get the images in forwarded mail. I really don’t know what’s happening with the approach., most of the cases the 2nd time forwarded mail is not showing the images properly. For example, consider I send a mail to client A, Here, Client A will get a mail with Images. Further, If Client A forward the same message to Person B then Person B is not getting Images in the Forwarded email. I’m using the following Approach to Embed an image in the mail template: StringBuilder sb = new StringBuilder(" <some html content> <img src=\"cid:main.png\" alt=\"\" border=\"0\" usemap=\"#Map\"> </html content ends here>"); Attachment imgMain = new Attachment(Server.MapPath("main.png")); imgMain.ContentId = "main.png"; MailMessageObject.Attachments.Add(imgMain); Instead of attachment, I tried bypassing the Image path from server directly. Something like as follows: StringBuilder sb = new StringBuilder(" <some html content> <img src=\"www.mydomain.com/images/main.png\" alt=\"\" border=\"0\" usemap=\"#Map\"> </html content ends here>"); But, result is same, Please help to resolve this problem

    Read the article

< Previous Page | 44 45 46 47 48 49 50 51 52 53 54 55  | Next Page >