w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Get exif data in mac OS development
This post did it: http://devmacosx.blogspot.com/2011/07/nsimage-exif-metadata.html. I can now read all the exif data that I'm looking for.

Categories : Objective C

Trying to understand exif.encode_unicode
I'm reasonably sure that that config tells the exif code which character set to convert to when it's converting the text that is stored in the image. The issue will be that some of the text read from the exif data will either claim to be in UTF-8 format but actually has some invalid bytes, or is in some other way garbled. If you want to investigate the cause of the issue, which may be worth reporting as a bug if it affects lots of images, you can get the raw bytes from the text, and should be able to see what exactly is causing the error by emitting the raw bytes: foreach ($exif_data as $key => $value) { $resultInHex = unpack('H*', $value); $resultInHex = $resultInHex[1]; $resultSeparated = implode(', ', str_split($resultInHex, 2)); //byte safe var_dump($resultSepa

Categories : PHP

Reading EXIF gives an error
you should use the _getexif() method of that comes bundled in PIL's Image module: >>> image = Image.open(os.getcwd() + '/canon-ixus.jpg') >>> image._getexif() {36864: '0210', 37121: 'x01x02x03x00', .... } or also image.info['exif']: >>> image.info['exif'][0:20] 'Exifx00x00II*x00x08x00x00x00 x00x0fx01x02x00'

Categories : Python

Image metadata MediaStore vs. EXIF
What's the difference between the two? The MediaStore information contains a cached copy of some of that EXIF data, plus other metadata. Can it be safely assumed that data from both will ALWAYS be the same? No. If the MediaStore is up to date, then yes. However, images are files. Files can be changed. If the MediaStore indexes the image file in state A, then something modifies the image file to state B, unless something causes the MediaStore to update its cache, they will be out of sync.

Categories : Android

How to get / set jpeg exif data with objective c - mac os
http://libexif.sourceforge.net/ appears to be a common C library for exif data. (First result on Google search for 'exif c') There seems to be a few C++ libraries, but no pure Objective-C that I could find easily

Categories : Objective C

Read Exif GPS info using Delphi
If you require no external libraries, you can do this with TFileStream and an array of byte. I've done this in a project to obtain the 'picture taken date', the GPS lat-long coordinates are just another field in the EXIF header. I don't have the code here but the method is straight-forward: once you have a TFileStream to the JPEG file: Read the first 2 bytes, check it is in fact $FF $D8 (just to be sure it's a valid JPEG) Read the next 2 bytes, check if it's $FF $E1 if it's not, depending on which segment it is, read two more bytes (or a word) and skip that much bytes (by calling the stream's Seek method), there's a list of segments here: https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure; then repeat If it is, read 4 bytes and see if it's 'Exif' ($45 $78 $69 $66) What follows is

Categories : File

C# Image Resizing - Losing EXIF
The following code worked for me: const string InputFileName = "test_input.jpg"; const string OutputFileName = "test_output.jpg"; var newSize = new Size(640, 480); using (var bmpInput = Image.FromFile(InputFileName)) { using (var bmpOutput = new Bitmap(bmpInput, newSize)) { foreach (var id in bmpInput.PropertyIdList) bmpOutput.SetPropertyItem(bmpInput.GetPropertyItem(id)); bmpOutput.SetResolution(300.0f, 300.0f); bmpOutput.Save(OutputFileName, ImageFormat.Jpeg); } } When I inspect the output file I can see EXIF data and the DPI has been changed to 300.

Categories : C#

Mapping exif data to long/lat
You devide the minutes and seconds by 100, but well, you shouldn't: $d = $deg + ((($min/60) + ($sec/3600))/100); should be: $d = $deg + (($min/60) + ($sec/3600)); one minute is 1/60 degree and a second is 1/60 minute. for a more thorough answer, see here: PHP extract GPS EXIF data

Categories : PHP

How to get the Rating of image files from Exif library
Finally i solve my problem.The propertyId for Find Image Rating is 18246 i Just replace my code like PropertyItem propItem = er.bmp.GetPropertyItem(18246); String rating = BitConverter.ToInt16(propItem.Value, 0).ToString(); It works fine for me.

Categories : C#

In what forms does Android return EXIF GPS data?
Are you using ExifInterface in GetImageGps? Try it something like this (make sure to use the getLatLong method) ExifInterface exifInterface = new ExifInterface(fileName); float[] latLng = new float[2]; if (exifInterface .getLatLong(latLng)) { //file has exif latlong info //etc, latLng[0] is your latitute value and latLng[1] your longitude value }

Categories : Java

Image Resizing without losing Exif Data?
it certainly depend on how you are resizing the image that exif is maintained or not. In most of the cases resizing and saving it back in iPhone causes loss of Exif info. A possible solution would be to fetch the exif data then resize the image. then rewrite exif back.

Categories : Iphone

preserve exif data while resizing images
Finally I got the solution, http://stackoverflow.com/a/11813684/658976 This confirms all images uploaded to server had file path (no buffered images).

Categories : Python

how maintain exif data of images resizes using PIL
Note: I haven't done this myself yet, but to my knowledge, PIL only allows to read exif tags but cannot write them. You will probably need gexiv2 or pyexiv2 to write the tags to your thumbnails. UPDATE: I got curious and tried it myself :D If i got you right, you just want to copy the metadata without further modifications. This is still crude but seems to work: import os import Image import pyexiv2 fp = '/home/klaus/workspace' fn = 'img_2380.jpg' full_path = os.path.join(fp, fn) print full_path im = Image.open(full_path) size = 512, 512 im.thumbnail(size, Image.ANTIALIAS) im.save('bla.jpg', 'JPEG') oldmeta = pyexiv2.ImageMetadata(full_path) oldmeta.read() # read metadata of the original file newmeta = pyexiv2.ImageMetadata('bla.jpg') newmeta.read() # read metadata of the new file

Categories : Python

image save to memorystream exif format
Actually I don't think it works even for saving file on disk. If you open the saved file it has PNG in the header. If you check the internals, the save method looks like this: public void Save(string filename, ImageFormat format) { if (format == null) { throw new ArgumentNullException("format"); } ImageCodecInfo imageCodecInfo = format.FindEncoder(); if (imageCodecInfo == null) { imageCodecInfo = ImageFormat.Png.FindEncoder(); } this.Save(filename, imageCodecInfo, null); } Problem is there is no encoder associated with the EXIF format - try debugging var imageEncoders = ImageCodecInfo.GetImageEncoders(); So you may as well use Image image = Image.FromFile(@"C:Users kaemmerlingPicturesalpha-test-photo.jpg"); image.Save(@"C:Use

Categories : C#

Read/Write exif/jpeg on windows using c++
Windows GDI+ provides the Image class for working with raster images (bitmaps) and vector images (metafiles). The Bitmap class and the Metafile class both inherit from the Image class. The Bitmap class expands on the capabilities of the Image class by providing additional methods for loading, saving, and manipulating raster images. The Metafile class expands on the capabilities of the Image class by providing additional methods for recording and examining vector images. See: http://msdn.microsoft.com/en-us/library/windows/desktop/ms533815(v=vs.85).aspx Image metadata is in the subcategory How to read image metadata, saying: GDI+ currently supports metadata for the TIFF, JPEG, Exif, and PNG file formats.

Categories : C++

Resize and set quality on JPEG image while retaining EXIF in iOS
You can use a utility like ExifTool to strip and restore the EXIF. This is a cross-platform command-line utility. Below are the appropriate commands to do what you want. To remove the EXIF: exiftool -exif= image.jpg To restore the EXIF again after editing the image: exiftool -tagsfromfile image.jpg_original -exif image.jpg In this example I have taken advantage of the "_original" backup automatically generated by ExifTool.

Categories : IOS

IOS :Get UIImage Orientation inside a UIImageview with exif data?
You can use myImage.imageOrientation, which will give you the UIImageOrientation. OR If you used UIImagePickerViewController then use its delegate method "imagePickerController:didFinishPickingMediaWithInfo:" In This method you can also access the info dictionary NSlog(@"%d", [info objectForKey:@"Orientation"]);

Categories : Iphone

Objective-C/ALAssetslibrary - Take gps latitude from image exif informations
There's a catch. The default representation returned from the assets library has stripped things like EXIF data from the image so that's why you can't find it. What I found was that if I extract the bytes that form the image manually, I could reconstruct the image and then get the EXIF data from it. Here's a function that will get the bytes and return them as an NSData object: @implementation PhotoLibrary ... #define MAX_IMAGE_SIZE_LIKELY (700 * 1024) static uint8_t assetBytes[MAX_IMAGE_SIZE_LIKELY]; + (NSData*) getDataFromAsset:(ALAsset*)asset { ALAssetRepresentation* rep = [asset representationForUTI:(NSString*)kUTTypeJPEG]; if (rep != nil) { [rep getBytes:assetBytes fromOffset:0 length:[rep size] error:NULL]; return [NSData dataWithBytes:assetBytes length:[rep s

Categories : Objective C

Drupal 7, iPhone image orientation messed up - no exif information
You are not seeing things. iPhone/Pad strip the EXIF info when they send the image. Image upload from iphone strips exif data The EXIF Custom Module may be of help. https://drupal.org/project/exif_custom So might ImageCache Actions https://drupal.org/project/imagecache_actions

Categories : Iphone

Editing/Remove Exif Image data on Windows Phone
There's a blog post here showing how to remove the EXIF data without reencoding the image. Code from the post using System.IO; namespace ExifRemover { public class JpegPatcher { public Stream PatchAwayExif(Stream inStream, Stream outStream) { byte[] jpegHeader = new byte[2]; jpegHeader[0] = (byte)inStream.ReadByte(); jpegHeader[1] = (byte)inStream.ReadByte(); if (jpegHeader[0] == 0xff && jpegHeader[1] == 0xd8) //check if it's a jpeg file { SkipAppHeaderSection(inStream); } outStream.WriteByte(0xff); outStream.WriteByte(0xd8); int readCount; byte[] readBuffer = new byte[4096]; while ((readCount = inStream.Read(

Categories : C#

Exif field ImageDescription adding data is not fully successful
2 things: (a) Look at PropertyItem.Type definition: 1: Specifies that Value is an array of bytes. 2: Specifies that Value is a null-terminated ASCII string. If you set the type data member to ASCII type, you should set the Len property to the length of the string including the null terminator. For example, the string "Hello" would have a length of 6. Looks like you are using it wrong - either it should be (1) - and then you should save array of bytes, or it should be (2) - but then you need to pass ASCII string to it. Look at this question as well: Set image meta data before save (b) Set ptype.Len property to the length of the string. http://msdn.microsoft.com/en-us/library/system.drawing.imaging.propertyitem.type.aspx

Categories : C#

exif image rotation issue using carrierwave and rmagick to upload to s3
I had a similar problem and fixed it with an approach nearly identical to yours. # In the uploader: def auto_orient manipulate! do |img| img = img.auto_orient end end (Note that I am not calling auto_orient! - just auto_orient, without the bang.) Then I have process :auto_orient as the first line of any version I create. For example: version :square do process :auto_orient process :resize_to_fill => [600, 600] end

Categories : Ruby On Rails

Android: Image upload to web-service loses EXIF data
EXIF data is stripped during encode. However, ExifInterface will allow you to set the EXIF data on the compressed file. Unfortunately, you'll need to compress the image, write it to a file, then set the EXIF on the file, and finally upload that.

Categories : Java

Preserve exif data of image with PIL when resize(create thumbnail)
I read throught some of the source code and found a way to make sure that the exif data is saved with the thumbnail. When you open a jpg file in PIL, the Image object has an info attribute which is a dictionary. One of the keys is called exif and it has a value which is a byte string - the raw exif data from the image. You can pass this byte string to the save method and it should write the exif data to the new jpg file: from PIL import Image size = (512, 512) im = Image.open('P4072956.jpg') im.thumbnail(size, Image.ANTIALIAS) exif = im.info['exif'] im.save('P4072956_thumb.jpg', exif=exif) To get a human-readable version of the exif data you can do the following: from PIL import Image from PIL.ExifTags import TAGS im = Image.open('P4072956.jpg') for k, v in im._getexif().items():

Categories : Python

How to make django-photologue autorotate image with info from EXIF?
Well, I did it like this file photologue/models.py: IMAGE_EXIF_ORIENTATION_MAP = { 6: 0, 3: 2, 8: 3, 1: 4, } def pre_cache(self): if self.EXIF.get('Orientation', 1) is not None: im = Image.open(self.image.path) im = im.transpose(IMAGE_EXIF_ORIENTATION_MAP[self.EXIF.get('Orientation', 1)]) im.save(self.image.path) cache = PhotoSizeCache() for photosize in cache.sizes.values(): if photosize.pre_cache: self.create_size(photosize)

Categories : Django

VBA Set custom document property
There may be some quirk about files from Sharepoint, admittedly this is not something I am familiar with, but from reading other threads I know there are some difficulties with these files. This may or may not be the case, here. In any case, we can try to diagnose it and perhaps we will resolve the problem. As I mentioned in the comments, I can replicate this error if the named DocumentProperty ("Script Status") doesn't exist in my workbook. This could be as easy as a typo, perhaps. You can use this function to test whether a named DocumentProperty exists: Function CustomPropertyExists(propName As String) As Boolean Dim wb As Workbook Dim docProp As DocumentProperty Dim propExists As Boolean Set wb = Application.ThisWorkbook For Each docProp In wb.CustomDocumentPr

Categories : Excel

Is it possible to add custom property to CActiveRecord in yii?
Yes it is possible. In your model after the <?php /** * This is the model class for table "{{table}}". * * The followings are the available columns in table '{{table}}': * @property integer $id ....... */ class Table extends CActiveRecord { part you can define custom properties for your class. Like this: class Table extends CActiveRecord { public $aPublicAttribute; private $_aPivateAttribute; You can reference these just like you reference the attributes that exist in your table.

Categories : PHP

Parse value to None in ndb custom property
Maybe you are looking for something like ndb.ComputedProperty? class YourBool(ndb.Model): my_input = StringProperty() val = ndb.ComputedProperty( lambda self: True if self.my_input in ["1","t","True","y","yes"] else False)

Categories : Python

KVO with custom class property
self.aSubjectView must be initialized and not be nil when adding the observer. in observeValueForKeyPath you're currently just checking if self.aSubjectView is initialized but you should rather check if (object == self.aSubjectView) try [self.aSubjectView addObserver:self forKeyPath:@"sizeForScrollView" options:NSKeyValueObservingOptionNew context:NULL]; -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ if (object == self.aSubjectView) { self.scrollView.contentSize = CGSizeMake(self.aSubjectView.sizeForScrollView.width, self.aSubjectView.sizeForScrollView.height); self.aSubjectView.frame = CGRectMake(frameForView.origin.x, frameForView.origin.y, frameForView.size.width, self.aSubjectView.

Categories : IOS

Get custom property of a file in python
See this answer. It suggests using Python win32 extensions, however this project seems to be for Python 2.7 and earlier so it won't work for Python 3.x if you are using that. Alternatively try advice in this answer - using DSOFILE.DLL (although this advice might be obsolete for windows 7). However what I understood from it, the method to get this metadata varies with file type, so more details might be helpful.

Categories : Python

Select a control by custom property
LINQ will iterate over whole collection of ProgressBars as well, so it's not any better than your current solution. You should consider preparing Dictionary<string, ProtectProgressBar> and using it to find the correct one using it's ID: var bars = pnlProtect.Controls.OfType<ProtectProgressBar>().ToDictionary(c => c.Id, c => c); for (int i = 0; i < protectMaxPlayers; i++) { // Update the protect time. protect.setProtectTime(i, protect.getProtectTime(i) - 1); ProtectProgressBar bar; if(bars.TryGetValue(i, out bar)) { bar.Value = protect.getProtectTime(i); } } Dictionary<TKey, TValue> lookup is done in O(1) time, so it should be better then you current solution.

Categories : C#

WPF Adding a custom property in a control
You can use the attached properties: public class Extensions { public static readonly DependencyProperty OverWidthProperty = DependencyProperty.RegisterAttached("OverWidth", typeof(double), typeof(Extensions), new PropertyMetadata(default(double))); public static void SetOverWidth(UIElement element, double value) { element.SetValue(OverWidthProperty, value); } public static double GetOverWidth(UIElement element) { return (double)element.GetValue(OverWidthProperty); } } Xaml: xmlns:extensions="clr-namespace:NAMESPACE FOR Extensions class" <Trigger Property="IsMouseOver" Value="true"> <Setter Property="MinWidth" Value="{Binding Path=(extensions:Extensions.OverWidth), RelativeSource={RelativeSource Self}}"/> </Trigg

Categories : C#

Property Grid Custom Editor
You need to define a class that inherits from UITypeEditor who's job will be to display Form1. This type is what goes into the EditorAttribute (not Form1). The sample here is more or less what you need to implement. Basically, you override GetEditorStyle to return UITypeEditorEditStyle.Modal and override EditValue to call IWindowsFormsEditorService.ShowDialog on an instance of your form.

Categories : C#

Failing to get/set custom attached property
First of all, I think that's a dependency property you declared there, and it belongs to the IconButton custom control, and you're trying to use it on a Button control. See http://msdn.microsoft.com/en-us/library/ms749011.aspx for reference on how to declare attached properties, and assign that property to the Button class instead of the IconButton since you're not using that custom control in the code above.

Categories : C#

ASP.NET Custom Control Property Access
When you select a listbox value, it changes in client side. But you are using serverside code to get the value, '<% Response.Write(fileBrowser.SelectedPath);%>' which is still 'empty' (initial value), untill the page is posted back. In the user control if you set AutoPostBack="True" for the ListBox, you will get desired result.

Categories : C#

How to create Custom Property for WPF DataGridTextColumn
I just got answer for it First Create public static class dataGridTag { public static readonly DependencyProperty TagProperty = DependencyProperty.RegisterAttached( "Tag", typeof(object), typeof(dataGridTag), new FrameworkPropertyMetadata(null)); public static object GetTag(DependencyObject dependencyObject) { return dependencyObject.GetValue(TagProperty); } public static void SetTag(DependencyObject dependencyObject, object value) { dependencyObject.SetValue(TagProperty, value); } } For Binding tag property by C# DataGridTextColumn clm = new DataGridTextColumn(); dataGridTag.SetTag(clm, "TagValue"); For Retrieving tag property by

Categories : C#

Reference custom object property
You're looping once too much. Change for (var i = 0; i <= canvobjects.length; i++) { to for (var i = 0; i < canvobjects.length; i++) { // ^

Categories : Javascript

Custom attribute to change property value
Okay.. hopefully I've understood your requirement: class GetStoreNumberFromNameAttribute : Attribute { } class Class1 { [GetStoreNumberFromName] public string store { get; set; } } class Validator<T> { public bool IsValid(T obj) { var propertiesWithAttribute = typeof(T) .GetProperties() .Where(x => Attribute.IsDefined(x, typeof(GetStoreNumberFromNameAttribute))); foreach (var property in propertiesWithAttribute) { if (!Regex.Match(property.GetValue(obj).ToString(), @"^d+$").Success) { property.SetValue(obj, Regex.Match(property.GetValue(obj).ToString(), @"d+").Groups[0].Value); } } return true;

Categories : C#

Implementing automatic rotation of JPEG images according to EXIF Orientation in ImageIO plugin
Given that every image reader in the World automagically flips the image correctly, I'm betting that virtually everybody would be fine with this happening automatically. In a sense, the image "is" the it's rotated version even if the bitmap portion of the image file says different. The whole file is the standard. And yes, I'd be very happy if ImageIO.read() would just, um, work. It should give me an image that is as it would be displayed by every known viewer on the planet. Sure, include some APIs to get at it the raw way if somebody really wants that, but the default behavior should be the prevailing usage pattern, and the way that makes sense. Why would you ever have a need to view it in the wrong orientation? There might be odd use cases, but I bet they are very rare compared to the no

Categories : Java

Undefined Property with Custom 404 Page in Codeigniter
Check out http://ellislab.com/codeigniter/user-guide/general/errors.html Stated there that the 404 will be triggered when a controller is not found. That's why your first scenario works fine. But in your second scenario, codeigniter found your controller but not your method. Regards.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.