 |
|
 |
In Function GetInt16: replase Return B(1) << 8 Or B(0) to Return System.BitConverter.ToInt16(B, 0).
In Function GetInt32: replase Return B(3) << 24 Or B(2) << 16 Or B(1) << 8 Or B(0) to Return System.BitConverter.ToInt32(B, 0).
'
|
|
|
|
 |
|
|
 |
|
 |
Hi,
I am having a bugger of a time trying to figure this out. I am working in VB2008 and am trying to extract Latitude, Longitude, and Altitudes. Some of the returns are very obvious, but I am having issues with others. While stepping through the code, when it returns the values for longitude or latitude, it comes as an array. Most are simple, but occasionally I get something like the following:
0 42
1 0
2 0
3 0
4 1
5 0
6 0
7 0
8 50
9 0
10 0
11 0
12 1
13 0
14 0
15 0
16 13
17 2
18 0
19 0
20 100
21 0
22 0
23 0
somehow, I should get 5.25 seconds (I would suspect 525 in slot 16 of the array, but it returned 13 in 16 and 2 in 17. Adjusting GetRational to look at the 16 to 23 slots and then running them through the GetInt32, it just doesn't seem to look past the value listed in the 16 slot. Any one else come across this? Any insight is appreciated.
Thanks,
Dale
|
|
|
|
 |
|
 |
Probably not news for most of you, but it turns out the VB 2008 built in function BitConverter.ToUInt32 works for this. Kind of a black-box thing for me, since I don't know what it is doing under the hood, but it gives me the answer, which is what I needed at this point.
Thanks,
Dale
|
|
|
|
 |
|
 |
Just started playing with ExifWorks. Thanks a lot, it made my life much much easier. However, I'm still trying to get the image altitude and orientation (which direction the camera was facing). I'm currently assuming they are GPSAltitudeRef/GPSAltitude and GPSImgDirRef/GPSImgDir. However, I have no idea what format these are stored in, nor how to properly create a Get statement for them.
I currently don't have a need to write or change these values, only to read them.
Any help figuring this out would be great! Thanks again.
|
|
|
|
 |
|
 |
I have tried this on a bunch of JPG photos and I get 0.0 always returned as SubjectDistance.
Can anyone advise please?
|
|
|
|
 |
|
 |
This property is only populated in Exif if your lens supported it to begin with.
|
|
|
|
 |
|
 |
Good tuto...
i am giving 4 coz he forget to mention about tags
|
|
|
|
 |
|
 |
After I change the description it does not change in the actual file. I tried saving the me._Image bitmap but it will not let me overwrite file.
|
|
|
|
 |
|
 |
Just made mine work. It is a bit crazy, but seems to be the only way to make it work.
'load image into exif
Dim ef As New ExifWorks(PicPath)
'make changes to image as nec
ef.orientation= newor
'create temp image path
dim NewTempPicPath as string = samedirectory & filename & "_temp" & samefileext
'dim image as the _image from exifworks (make it public - comes private)
Dim imgWithExif As Image = ef._Image
imgWithExif.save(NewTempPicPath)
'now that the update image is saved
ef.dispose
'now delete original
.deletefile(PicPath)
'now copy temp file back to orig name
.copyfile(NewTempPicPath,PicPath)
'now delete temp file
'deletefile(NewTempPicPath)
Finally got it to work for me! had to change the setproperty method in the exif form to set teh proprtyID to the one that is being changed, but after that it worked great
|
|
|
|
 |
|
 |
Thanks for posting your code re fix for edit
However, I am having a problem with one line of code
dim imagewWithImage as Image = ef._image
an error occurs with >> ef._image
says is not accessible in this context because it is private
How do I fix this please
|
|
|
|
 |
|
 |
You have to make the "_Image" variable in the declarations PUBLIC. If i remember he made it private.
|
|
|
|
 |
|
 |
Hey..
I really need this file ..
can i have the file for vb.net?? i need to do it in vb.net... the downloadable file is in vb6 format.
It would be a big help.. plss ^^ thanks^^
if u can help me, i will give my email for sending ^^ i really really need it.
|
|
|
|
 |
|
 |
Is does not work with multipage tiff.
I only get first page on my new files.
Any idea ?
|
|
|
|
 |
|
 |
Hallo,
how can i to set / write "rational-data" like latitude / longitude ? Reading is not the problem but the writing.
Can anybody help me please?
modified on Friday, August 14, 2009 7:31 AM
|
|
|
|
 |
|
 |
see Saving Edits thread
also - i changed the SetProperties code in ExifWorks to
Dim P = (From e In _Image.PropertyItems() Where e.Id = PID).FirstOrDefault (this is under vs 2008 3.5 Framework)
P.Value = Data
P.Len = Data.Length
since we are not updateing the ID no need to set and there is also no reason to update the Type because we should not be changing the type either. You shouldnt be adding to the property list but updating them with new data.
|
|
|
|
 |
|
 |
Was looking at efixworks for some jpg manipulation for a slide show app.I would like to let the user tag photos when they are on screen. Is there any way to add tags like in vista pic viewer? like tag photos with italy or names of people in photos like loori or rod. this would be used to let user set slide show a tag group like show all Italy pics.
Thanks in advance!
|
|
|
|
 |
|
 |
Hi I just tried this code as well as some VB6 source, in both case it seems that the ISO speed info cannot be saved where I can change aperture and shutter speed. Any ides?
Thanks
Phil
|
|
|
|
 |
|
 |
Below is the code for extracting the Thumbnail image from the Exif data.
Public ReadOnly Property HasThumbnail() As Boolean
Get
Return IsPropertyDefined(TagNames.ThumbnailData)
End Get
End Property
Private mThumb As Image
Public ReadOnly Property Thumbnail() As Image
Get
If mThumb Is Nothing Then
Dim thumbData() As Byte = Me.GetProperty(TagNames.ThumbnailData)
If thumbData IsNot Nothing Then
Dim thumbStream As New IO.MemoryStream(thumbData)
Try
mThumb = Drawing.Image.FromStream(thumbStream)
Catch ex As Exception
End Try
End If
End If
Return mThumb
End Get
End Property
Also, when the image is loaded from a file, it normally has to load the entire full image, which takes a long time. If we tell the image not to load, it performs way better. This is especially useful if we're just trying to extract a thumbnail. So, below, I modified the constructor to skip loading the whole image.
Private shouldDisposeImage As Boolean
Public Sub New(ByVal FileName As String, Optional ByVal loadEntireImage As Boolean = False)
Dim fileStream As New System.IO.FileStream(FileName, IO.FileMode.Open, IO.FileAccess.Read)
Me._Image = System.Drawing.Image.FromStream(fileStream, True, loadEntireImage)
Me.shouldDisposeImage = True End Sub
Public Sub Dispose() Implements System.IDisposable.Dispose
If shouldDisposeImage Then Me._Image.Dispose()
End Sub
modified on Tuesday, June 23, 2009 1:05 PM
|
|
|
|
 |
|
 |
Works well. Have you tried to SET the thumbnail after editing the base image. I wrote up my own display form and made rotate functions. The base jpg image rotates but when the form redisplays, it is grabbing the thmbnail image coded within the jpeg fiel which doesnt have the rotation. I know many software viewing program auto rotate (if the camera has that function) but when uploading to a website (facebook, WIndows Live) the image has to be corrected because their displaying software doesnt auto-rotate.
Wondered if you had any luck writing back to the thumbnail image before I take a stab at it.
|
|
|
|
 |
|
 |
No, I haven't done that.
It might be really easy, basically you just reverse the decoding code that I wrote. Create a new thumbnail, save it to a memory stream, and put those bytes back into the PropertyItems.
However, it's up to the GDI classes to save it properly to the JPG format. Let me know how things turn out!
|
|
|
|
 |
|
 |
ok. Have written where a new thumbnail is generated based on the newly edit picture (rotated 90 degrees). I save the thumb as a file, loading into filestream and convert it to byte(). Return Byte() to calling function and then set exifworks newly created set function to created Byte()
Edited your get Thumbnail as
Public Property Thumbnail() As Image
Get
If mThumb Is Nothing Then ' Let's try to load the thumbnail from the raw bytes!
Dim thumbData() As Byte = Me.GetProperty(TagNames.ThumbnailData)
If thumbData IsNot Nothing Then
Dim thumbStream As New IO.MemoryStream(thumbData)
Try
mThumb = Drawing.Image.FromStream(thumbStream)
Catch ex As Exception 'Couldn't load the thumbnail Reason? Unknown.
End Try
End If
End If
Return mThumb
End Get
Set(ByVal value As Image)
'data is not saved as actual image but as a byte() within the jpeg exif metadata
Dim valueByte As Byte() = ConvertImageFiletoBytes(NewThmubImage)
Try
Me.SetProperty(TagNames.ThumbnailData, valueByte, ExifDataTypes.SignedByte)
Catch ex As Exception
End Try
End Set
End Property
Nothing seems to save. I tried to change the Orientation tag just to see if it was the byte() not being made correctly but even a simple update of this didnt work either - even hard coded the value in the set
Public Property Orientation() As Orientations
Get
Dim X As Int32 = Me.GetPropertyInt16(TagNames.Orientation)
If Not [Enum].IsDefined(GetType(Orientations), X) Then
Return Orientations.TopLeft
Else
Return CType([Enum].Parse(GetType(Orientations), [Enum].GetName(GetType(Orientations), X)), Orientations)
End If
End Get
Set(ByVal value As Orientations)
value = Orientations.TopLeft
Me.SetPropertyInt16(TagNames.Orientation, value)
End Set
End Property
Any ideas?????
|
|
|
|
 |
|
 |
Alright, I battled over whether or not I wanted to fire up Visual Studio to take a stab at this, and eventually my curiosity won me over.
Your code was *really* close to correct but obviously "ConvertImageFileToBytes" was just high-hopes, so here's some totally untested code for you to try:
Set(ByVal value As Image)
If value IsNot Nothing Then
Dim thumbStream As New IO.MemoryStream()
value.Save(thumbStream, ImageFormat.Jpeg)
Dim thumbData() As Byte = thumbStream.ToArray
Me.SetProperty(TagNames.ThumbnailData, thumbData, ExifDataTypes.Undefined)
Me.mThumb = value
End If
End Set
The use of MemoryStream is necessary because the Save method of an image requires any Stream to write to. Also, the ExifDataType is Undefined because we have to write raw data.
The Orientation is just metadata, and has nothing to do with the actual thumbnail. However, if you are rotating the image, then it would be wise of you to also correct the Orientation tag.
|
|
|
|
 |
|
 |
MADE IT WORK!!!!!
Yeah!
I was sending the rotated image in memory to teh exifworks, trying to update the properties there. That wasnt wroking. So I saved the image rotated, then loaded the file into exifworks and tested for thumbnail. IF thmb was there then i created a new thumb from the rotated version and turned it into bytes (thanks) and then changed the SetProperty routine to loop through all the properties until the thmb ID was found and changed that. Then dim a new image as the exifworkd update image, saved it to a new temp file name (because exif still has control of the image). Once the new updated image is saved to disc then dispose of exifworks; delete original, copy temp to original name; then delete temp. This should jsut be easier.
I am going to take the looping out and should be able to just insert the PID in the propertyitem line and save processing time looping through all 47 properties!
Thanks for all your help.
|
|
|
|
 |
|
 |
By the way... dont have good wisdom on io.memstream stuff. Can you load a picture directly into a memorystream object?? Do you have to have the windows handle of the item??? any help on this one would be good.
|
|
|
|
 |