Posts

Showing posts with the label image

Android take picture, but save a small size 160x160 image in internal memory

Image
Clash Royale CLAN TAG #URR8PPP Android take picture, but save a small size 160x160 image in internal memory I have looked around but I could not find a suitable answer, hence asking it here. I want to take a picture, and save a lower size version eg. 160x160 size in phone's internal memory. Now, I have seen code saving full size picture in internal and external memory. I have seen code getting a bitmap thumbnail from the picture, but this exact scenario is not explored in depth anywhere. I do not want any copy of this picture to exist except a 160 x 160 size (whichever height/width limit applies) in internal memory. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How to use rootBundle in flutter to load images?

Image
Clash Royale CLAN TAG #URR8PPP How to use rootBundle in flutter to load images? I use image plugin ( image: ^2.0.4 ) so I can write something on to the image and later save it new image to device or send via mail. I try to load image using " new File " but got error on Flutter. I ask and search and got a hint that I can use rootBundle to load image in Flutter. I did, and I got this below error. [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception: Unable to load asset: packages/myAppName/assets/images/ReceiptRaw_1.jpg The plugin works when I create a simple dart console app, but couldn't load using flutter. Any help please, This is the Flutter Code: Future<bool> makeReceiptImage() async { // UPDATE **************************************** // load the receipt jpeg var imageData = await rootBundle.load('packages/myAppName/dekonts/ReceiptRaw_1.jpg'); print("imageData: $imageData"); // Prints as imageData: Instance of...

Image Encryption in Swift

Image
Clash Royale CLAN TAG #URR8PPP Image Encryption in Swift I am using IDZSwiftCommonCrypto for image encryption using StreamCryptor described as an example at its GitHub page: https://github.com/iosdevzone/IDZSwiftCommonCrypto IDZSwiftCommonCrypto I am not able to successfully decrypt. Here is my code for encryption and decryption (imageData comes from UIImageView ). The output is different from input after encryption (imageData is different from xx). UIImageView Encryption: func performImageEncryption(imageData: Data) -> Void { var inputStream = InputStream(data: imageData) let key = arrayFrom(hexString: "2b7e151628aed2a6abf7158809cf4f3c") var sc = StreamCryptor(operation:.encrypt, algorithm:.aes, options:.PKCS7Padding, key:key, iv:Array<UInt8>()) var inputBuffer = Array<UInt8>(repeating:0, count:1024) var outputBuffer = Array<UInt8>(repeating:0, count:1024) inputStream.open() var cryptedBytes = 0 ...

PHP script not displaying all images from directory

Image
Clash Royale CLAN TAG #URR8PPP PHP script not displaying all images from directory I'm trying to build a webpage that displays images from a folder using PHP. But for some reason it stopped displaying all images within the image folder and only a partial amount. I have pagination within the function, but not all images are being displayed. I checked the directory to ensure the files were in there and they are. When counting the files I get a total of 76 according to php. The directory has 74 images. But my page is only displaying 60 images. Please help me fix this! Here's the code I'm working with: <?php function show_pagination($current_page, $last_page){ echo '<br><div>'; if( $current_page > 1 ){ echo ' <button class="button" type="button"><a href="?page='.($current_page-1).'">&lt;&lt;Previous</a></button> ...

Processing images in java

Image
Clash Royale CLAN TAG #URR8PPP Processing images in java Which tools can I use to read ascii grids in java? http://docs.geotools.org/latest/userguide/library/coverage/arcgrid.html ArcGRidReader is one such option, however it depends on imageio and imageio-ext which can be really tricky to get set up & working correctly. Are there alternatives? ArcGRidReader imageio imageio-ext ncols 4 nrows 6 xllcorner 0.0 yllcorner 0.0 cellsize 50.0 NODATA_value -9999 -9999 -9999 5 2 -9999 20 100 36 3 8 35 10 32 42 50 6 88 75 27 9 13 5 1 -9999 NOTE: I need to obtain the GridCoverage2D somehow, as later on I want to execute a http://docs.geotools.org/latest/userguide/unsupported/process/process-raster.html polygon extraction process. GridCoverage2D By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that yo...

Image does not fit properly in collectionCell

Image
Clash Royale CLAN TAG #URR8PPP Image does not fit properly in collectionCell In Swift 3. My app has a table view and a detail view with is a view controller. Here I added a collection view. An array of images must be presented. The images adapt themselves beautifully if in portrait I check the content mode in scaler to fill. In ladscape it works in aspectFill. Vice-versa, the layout does not fit. I did the following in cellForItem At: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = myCollection.dequeueReusableCell(withReuseIdentifier: "cellCollection", for: indexPath) as! CollectionViewCell cell.cellImage.image = UIImage(named: array[indexPath.item]) if UIDevice.current.orientation.isLandscape{ cell.cellImage.contentMode = .scaleAspectFill } else if UIDevice.current.orientation.isPortrait{ cell.cellImage.contentMode = .scaleToFill } return cell } I...

Error Level Analysis with PHP

Image
Clash Royale CLAN TAG #URR8PPP Error Level Analysis with PHP im not a coder, but i do get logic and usually im able to do simple codes with PHP. Im looking to implement Error Level Analysis with PHP. You can see an example in this link. Its possible to implement ELA with ImageMagick or GD ? Any functions that i should look into it ? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Using (x, y) or (y, x) as pixel access for a C++ image class? [on hold]

Image
Clash Royale CLAN TAG #URR8PPP Using (x, y) or (y, x) as pixel access for a C++ image class? [on hold] I've been wondering what the best (==least prone to user errors) approach would be for a pixel access operator for an image class in C++. operator() is overloaded to access pixels at a location x, y in the image - but the question is should that access be (x, y) or (y, x)? Obviously, I think in principle, we'd be more used to (x, y) for image pixel access, but in mathematics, matrix access is usually (row, col), and since for an image, y is normally the row and x the col, that would result in (y, x). Note this question is only about the API, the access - and not memory storage (row/col-major) or anything like that. operator() x, y In Python, it's common to use NumPy or scipy.ndimage to represent images, which use (row, col) (equal to (y, x)). So, (row, col) access is quite common, because images are 2D arrays or matrices (or 3D in the case of 3-channel images). In OpenC...

How to make MultipartBbody.Part request from cache image using retrofit

Image
Clash Royale CLAN TAG #URR8PPP How to make MultipartBbody.Part request from cache image using retrofit My image is cached at located: file:///data/user/0/com.example.muhammadusman.project/cache/cropped1340954678061130725.jpg how can i make the Multipart.body request for this interface: @Multipart @POST("/image/{name}") Call<Recognition> recognizeImage( @Path("name")String name, @Part MultipartBody.Part image); Input to the Function key="40" imageName="cropped1340954678061130725.jpg" path="file:///data/user/0/com.example.muhammadusman.project/cache/cropped1340954678061130725.jpg" This is My Code: i am using this code to make the MultipartBody.Part object. But i am not able to make the object. Always program crash. public static MultipartBody.Part creatPartFromPath(String key,String imageName,String path){ File file=new File(path); String mediaType= getMimeType(path); Reques...

Add Text on Image using PIL

Image
Clash Royale CLAN TAG #URR8PPP Add Text on Image using PIL I have an application that loads an Image and when the user clicks it, a text area appears for this Image (using jquery ), where user can write some text on the Image. Which should be added on Image. jquery After doing some research on it, I figured that PIL (Python Imaging Library ) can help me do this. So I tried couple of examples to see how it works and I managed to write text on an image. But I think there is some difference when I try it using Python Shell and in web environment. I mean the text on the textarea is very big in px. How can I achieve the same size of text when using PIL as the one on the textarea? PIL Python Shell The text is Multiline. How can i make it multiline in image also, using PIL ? PIL Is there a better way than using PIL? I am not entirely sure, If this is the best implementation. html: <img src="images/test.jpg"/> its the image being edited var count = 0; $('textarea').a...

Overwriting a border on an image in Python PIL

Image
Clash Royale CLAN TAG #URR8PPP Overwriting a border on an image in Python PIL I have a gallery application where the users upload photos and my code gives it a border, writes some of the photo attributes on the border and stores it. image2 = Image.open('media/' + str(image.file)) width, height = image2.size; image2 = ImageOps.expand(image2, border=(int(width/25),int(height/20),int(width/25),int(height/10)), fill='rgb(0,0,0)') (Note that here my bottom border is longer than the top because I am writing attributes on the bottom border.) Now I'm building an edit feature for the uploaded images where the user can change the attributes of the uploaded images. But the attributes that are already written on the border have to be overwritten. So here, my approach is to put a black patch on the bottom border and re-write the new attributes without changes the top and side borders and without changing the aspect ratio. All of this has to be done using PIL. Question is how do ...