thumbnails

Thumbnail of an image from resources

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:55:30
问题 I want to make a thumbnail of an image.The image is in the resourse-drawable.Can anyone help me. 回答1: try this code im=(ImageView)findViewById(R.id.imageView1); byte[] imageData = null; try { final int THUMBNAIL_SIZE = 64; //InputStream is=getAssets().open("apple-android-battle.jpg"); FileInputStream fis = new FileInputStream("/sdcard/apple.jpg"); Bitmap imageBitmap = BitmapFactory.decodeStream(fis); Float width = new Float(imageBitmap.getWidth()); Float height = new Float(imageBitmap

Creating a image thumbnail in javafx

≡放荡痞女 提交于 2019-12-10 15:55:12
问题 Can someone please help with some code for creating a thumbnail for a image in JavaFx. I'm new at this, so a step by step explanation would be appreciated. 回答1: You can use an Image constructor to create a thumbnail image from a larger image, here is a sample from the Image javadoc: // load an image and resize it to width of 100 while preserving its // original aspect ratio, using faster filtering method // The image is downloaded from the supplied URL through http protocol Image image3 = new

how handling image's mime type “application/octet-stream”?

社会主义新天地 提交于 2019-12-10 14:53:59
问题 I have a function to make thumbnail of a url image on fly! I always pass to this functions images with type jpg, but the problem appears when I pass an image with ".jpg" extension. but when i try to get its mime type, i found that's " application/octet-stream " .. in this php page, this mime type refers to one of IMAGETYPE_JPC,IMAGETYPE_JPX,IMAGETYPE_JB2 what I need to modify my function to handle this mime type ?? notice ^^^^^^ function thumb($path,$width,$height) // $path => image url {

Android getting path to image from Thumbnail?

牧云@^-^@ 提交于 2019-12-10 14:48:45
问题 I'm trying to ship a pivotal update to my app currently on the market. I need to query the thumbnails in the MediaStore, and load the the thumbnails into a GridView. So far so good, now I just need to get the path of the actual fullsized image on the user's External Storage based only on what I have(which is the path to the thumbnail). I need to be able to perform 4 actions whenever a user clicks a thumbnail, Share, View, Move and Delete...but I can't do any of these with just the thumbnail

Android: Read image as thumb in runtime

时光毁灭记忆、已成空白 提交于 2019-12-10 12:08:39
问题 For a custom gallery im creating using a gridview with imageviews, i wish to read an image from sd storage. This gives me huge perfomance issues, because it will read the whole image, and load this into the imageview. How can i read a large image as a thumb in runtime with emphasis on performance? File imgFile = new File(img.getInternalImagePath()); if(imgFile.exists()){ Bitmap myBitmap; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 4; myBitmap =

Generate data URL from image

只谈情不闲聊 提交于 2019-12-10 11:35:15
问题 The simple problem I have a thumbnail from the Google Drive API and I need to save a copy because it has a validity expiration. Context I am building a backend for admins to add content to the website and I use Google Drive as resource management tool. I am running it on Meteor, so it's Nodejs on server-side. Attempts Use the well-known canvas method to retrieve the data url getImageDataURL = function (URL, cb) { var img = document.createElement("img"); var canvas = document.createElement(

How to thumbnail faster in c#

ⅰ亾dé卋堺 提交于 2019-12-10 11:33:05
问题 I'm trying to thumb an image as fast as possible regardless of the usage of resources to be used in my ImageList and listview and this is currently how i'm doing it but it seems to be slow: public Image toThumbs(string file, int width, int height) { image = null; aspectRatio = 1; fullSizeImg = null; try { fullSizeImg = Image.FromFile(file); float w = fullSizeImg.Width; float h = fullSizeImg.Height; aspectRatio = w / h; int xp = width; int yp = height; if (fullSizeImg.Width > width &&

Choosing between Imagemagick & GD for thumbnail creation

蹲街弑〆低调 提交于 2019-12-10 11:28:21
问题 I'm going to write a function for thumbnail creation. I can use both Imagemagick & GD Library methods. Which method creates better thumbnails and is faster and better for server (load, ...)? Thanks 回答1: $im = imagecreatefromjpeg('photo.jpg'); $ox = imagesx($im); $oy = imagesy($im); $nx = 320; $ny = 240; $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm,$im,0,0,0,0,$nx,$ny,$ox,$oy); imagejpeg($nm, 't_photo.jpg'); VS exec('convert photo.jpg -resize 320x240 t_photo.jpg'); What do you

Using Thumbnailator, can i make thumbnail with same height and width regardless the image size

人盡茶涼 提交于 2019-12-10 09:35:29
问题 In Thumbnailator, i am making thumbnails. If image size is 400*300 and if i do following thing, Thumbnails.of(new File("original.jpg")) .size(160, 160) .toFile(new File("thumbnail.jpg")); it create thumbnail of 160*120. What i want is if i upload 400*300 image, it will center zoom so that i will become 300*300 and then it will thumbnail. I gone through the documentation, Even i posted same thing over there in comment but no luck. 回答1: Sounds like a job for the [ sourceRegion ][1] method which

Using the PHP GD library to resize and save images is HELL

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 09:00:32
问题 I'm writing a script that will upload a file from user input, resize it to a thumbnail and add the two new filenames to a database. However, I cannot for the life of me figure out how to get PHP to detect the image's MIME type and then give it to the header. Here is the code, I've put comments to try and make it as clear as possible: $picture = $_FILES['picture']['name']; /*original file location*/ $file = 'picture/'.$picture.''; /*save thumbnail location*/ $save = 'thumb/tn-'.$picture.''; /