Original
Gps and EXIF data
To start and put yourself into the action we need to talk about some basic thing in life, like… your smartphones and all those lovely pictures that you take to your face (selfies) and to your food (foodies?). Everytime that you take a picture your dear phone attach some data to that picture, that data it’s called EXIF DATA , besides the date, hour, and that kind of logical data that it’s very useful and important, you also have a lot of technical data of your camera, like exposure, focal length and another funny things about pictures that probably if you take a lot of selfies this is the first and last time you heard about it.
To the POINT
Ok I will try to be nice, well the thing it’s with my friend Marceliwi we were talking about life, and website and a idea come to our minds (that sound like some kind of zerg-hive mind thinking) and in this idea at some point I endend trying to do something that before leaving Chile I have in mind, get some Gps data from my pictures and try to display it in a nice lovely designed way (some shit narrow ultra unlegible thin font with drop shadow).
Getting Data from the picture
Lately I’m really into Jekyll and, well not pay for having a blog, frontmatter, limitations of github pages, so my first and only option was JAVASCRIPT, JS to friends.
A little google search and Badaboom!!, some good guy made a library to get the EXIF data from pictures and it’s coming with a PDF that explains a lot of things about EXIF, that’s what I call a well documented plugin.
Welcome to trouble-town sucker
So, plugin found, time get those hands dirty, Hi my name it’s NULL and this is my friend UNDEFINED, I grab one of the pictures from past week, and try to get the location, surprise, no location… and guess who get obssesed with understand what was wrong, moi (that’s french).
how it’s this possible!?!?
I said to myself in my funny voice.
Photos app, search for the info, and there was, the bloody map with the location of the picture, but seconds before, there was nothing in my little Js experiment, well maybe was the picture, so try again, and again, and again, and again, and FUCK THIS SHIT what’s wrong with this universe?!?!?!.
Back again to google to search for some answers and well, it’s kind of hard find the answers with the words “gps location picture photos”.
I want to take this paragraph to say thanks to Apple again for having such a creative name for the photos app, photos.
After a while and a lot of tries, in one random blog one comment brings light to my dark life…
“The moment it is emailed or uploaded, all of that information is stripped.”
Sharri
This random guy gives me the solution to my problem, the thing it’s that actually for security reasons appears that when you upload a picture to flickr or even when you copy a picture from Photos to another place, the Exif GPS Data gets stripped from the picture, I say appears cuz I only experimented finding the original pictures inside the Photos package library.
But you’re not explaining anything you moron
That’s right my knowledge-starving friend, I’m just telling the not-code part of the problem, If you want to understand more about EXIF and how Flickr does to get all that data click this incredible long link so you can learn an understand how to translate the first 128k of information in the EXIF and read it from bytes to human.
And voila (that’s french) problem solved, now I have pictures with a lot of EXIF DATA for this little weird idea, actually I always had those pictures, but thanks for protect my life from the evil location searchers in the universe, and again thanks to apple for REMOVE the “Show file in finder” from Photos.
Where are my “originals”?
The easy way, look at the gif:
Even that the folders doesn’t make so much sense, if you look at the numbers, you will realize that are created by month, then by day, and then some strange numbers with your pictures inside, so for your EXIF DATA EXTRACTION try to use this files, probably if you are on Windows, you won’t have this kind of problems, and if you are in Linux, well probably you will be writing a better plugin rather than reading this post.
Forget about the hard way, why should you want to do things in the hard way if you can do it in the easy way, and that my friends, it’s a life lesson, about doing things easy, not about the EXIF GPS DATA extraction.
GPS y datos EXIF
Para arrancar y meterte en el tema necesitamos hablar de algo básico en la vida, como… tus smartphones y todas esas fotitos que te sacás a la cara (selfies) y a la comida (¿foodies?). Cada vez que sacás una foto tu querido teléfono le adjunta datos a esa imagen, esos datos se llaman DATOS EXIF. Además de la fecha, la hora y ese tipo de datos lógicos que son muy útiles e importantes, también tenés un montón de información técnica de tu cámara, como exposición, distancia focal y otras cosas graciosas sobre las fotos que probablemente, si sos de las que se sacan muchos selfies, esta sea la primera y última vez que las escuchás.
Al GRANO
Bueno, voy a intentar ser claro, la cosa es que con mi amigo Marceliwi estábamos hablando de la vida, de sitios web, y se nos ocurrió una idea (suena a algo tipo mente-colmena zerg) y en esa idea, en algún punto, terminé intentando hacer algo que tenía en mente antes de salir de Chile: obtener los datos GPS de mis fotos y mostrarlos de una manera bonita y bien diseñada (alguna tipografía fina, ultra ilegible, con drop shadow, de esas que usamos).
Obtener datos de la foto
Últimamente estoy muy metido en Jekyll y, bueno, en no pagar por tener un blog, el frontmatter, las limitaciones de GitHub Pages, así que mi primera y única opción fue JAVASCRIPT, JS para los amigos.
Una pequeña búsqueda en Google y ¡Badaboom!!, algún tipo bueno hizo una librería para obtener los datos EXIF de las fotos y viene con un PDF que explica un montón de cosas sobre EXIF, a eso le llamo yo un plugin bien documentado.
Bienvenido al pueblo de los problemas, sucker
Plugin encontrado, hora de ensuciarse las manos. Hola, me llamo NULL y este es mi amigo UNDEFINED. Agarré una de las fotos de la semana pasada e intenté obtener la ubicación. Sorpresa: sin ubicación… ¿y adivinen quién se obsesionó con entender qué estaba mal? Moi (eso es francés).
¡¿cómo es esto posible!?!?
Me dije a mí mismo con mi voz graciosa.
Abrí la app de Fotos, busqué la info, y ahí estaba, el dichoso mapa con la ubicación de la foto. Pero segundos antes no había nada en mi pequeño experimento con Js. Bueno, quizás era esa foto, así que lo intenté de nuevo, y de nuevo, y de nuevo, y de nuevo, y A LA MIERDA ¿qué tiene de malo este universo?!?!?!
De vuelta a Google buscando respuestas y bueno, es bastante difícil encontrarlas con las palabras “gps ubicación foto fotos”.
Quiero aprovechar este párrafo para agradecerle a Apple por ponerle un nombre tan creativo a la app de fotos: Fotos.
Después de un rato y muchos intentos, en un blog random un comentario le trajo luz a mi oscura vida…
“The moment it is emailed or uploaded, all of that information is stripped.”
Sharri
Este tipo random me dio la solución a mi problema. La cosa es que, por razones de seguridad, parece que cuando subís una foto a Flickr o incluso cuando la copiás desde Fotos a otro lugar, los Datos GPS EXIF se eliminan de la imagen. Digo parece porque yo solo lo experimenté encontrando las fotos originales dentro de la librería del paquete de Fotos.
Pero no estás explicando nada, idiota
Así es, mi amigo hambriento de conocimiento, solo te estoy contando la parte no-código del problema. Si querés entender más sobre EXIF y cómo Flickr obtiene todos esos datos hacé clic en este increíblemente largo link para que puedas aprender y entender cómo traducir los primeros 128k de información del EXIF y leerlos de bytes a humano.
Y voilà (eso es francés) problema resuelto. Ahora tengo fotos con un montón de DATOS EXIF para esta pequeña idea rara. En realidad siempre tuve esas fotos, pero gracias por proteger mi vida de los malvados buscadores de ubicaciones del universo, y de nuevo gracias a Apple por ELIMINAR el “Mostrar archivo en Finder” de Fotos.
¿Dónde están mis “originales”?
La manera fácil, mirá el gif:
Aunque las carpetas no tienen mucho sentido, si mirás los números te vas a dar cuenta de que están creadas por mes, luego por día, y luego unos números raros con tus fotos adentro. Así que para tu EXTRACCIÓN DE DATOS EXIF intentá usar esos archivos. Probablemente si estás en Windows no vas a tener este tipo de problemas, y si estás en Linux, bueno, probablemente estarías escribiendo un plugin mejor en lugar de leer este post.
Olvidate del camino difícil. ¿Por qué querrías hacer las cosas de la manera difícil si podés hacerlas de la manera fácil? Y eso, amigos, es una lección de vida, sobre hacer las cosas fácil, no sobre la extracción de DATOS GPS EXIF.
GPSとEXIFデータ
本題に入る_前に、人生における基本的なことについて話す必要がある。スマートフォンと、自分の顔(自撮り)や食べ物(フード写真?)に向けて撮るあの素敵な写真たちのことだ。_写真を撮るたびに、スマホはその写真にデータを付加する。そのデータはEXIFデータと呼ばれる。日付、時刻、そういった_論理的で便利で重要なデータ_に加えて、_カメラ_の技術的データもたくさん含まれている。露出、焦点距離、写真_に関する_面白い情報など。自撮りをよく撮るタイプなら、これを聞くのは最初で最後かもしれない。
本題へ
わかりやすく言う。友達のMarceliwiと人生やウェブサイトについて話していたら、一つの_アイデア_が浮かんだ(ザーグのハイブマインドみたいな感じ)。そのアイデアの中で、チリを出る前から考えていたことをやってみようとした。写真からGPSデータを取り出して、おしゃれなデザインで表示してみること(細くて読みにくいフォントにドロップシャドウをかけたやつ)。
写真からデータを取得する
最近はJekyllにはまっていて、ブログにお金を払わないこと、フロントマター、GitHub Pagesの制限などを考えると、選択肢はJAVASCRIPT一択だった。JSと呼ぶこともある。
ちょっとGoogle検索したら、ものの見事に!写真からEXIFデータを取得するライブラリを作ってくれた親切な人がいた。しかもEXIFについていろいろ説明したPDF付きで。これをよくドキュメントされたプラグインと言う。
ようこそトラブルの街へ
プラグインが見つかった。手を汚す時間だ。やあ、ぼくの名前はNULL、友達はUNDEFINED。先週の写真を一枚取り出して位置情報を取得しようとした。あれ、位置情報がない…。何が悪いのか執拗に調べまくったのは誰でしょう。私め(フランス語)。
これはどういうことだ!?!?
と、自分のちょっとおかしい声で言った。
Photosアプリを開いて情報を確認すると、写真の位置情報が入った例のやつマップがちゃんとあった。でも直前の自分の_Js実験_では何も出なかった。もしかして写真の問題か。また試した。また試した。また試した。また試した。もう無理、この宇宙は何が悪いんだ!?!?!?
また Google に戻って答えを探したけど、「gps 位置情報 写真 フォト」で答えを見つけるのは_なかなか難しかった_。
ちなみに、写真アプリに「写真」というとてもクリエイティブな名前をつけてくれたAppleにこの場を借りてお礼を言いたい。
しばらくしてたくさん試した後、あるランダムなブログのコメントが暗い人生に光をもたらしてくれた…
“The moment it is emailed or uploaded, all of that information is stripped.”
Sharri
このランダムな人が問題の解決策を教えてくれた。セキュリティ上の理由から、Flickrに写真をアップロードするときや、Photosから別の場所にコピーするときに、EXIF GPSデータが写真から削除されるらしい。_らしい_というのは、Photosのパッケージライブラリ内のオリジナル写真を探すことでしか確認できなかったから。
何も説明してないじゃないか、このバカ
そうです、知識に飢えた友よ、ここではコード以外の部分を話しているだけ。EXIFについてもっと理解したい人、FlickrがどうやってそのデータをすべてGETしているかを知りたい人はこの超長いリンクをクリックして、EXIFの最初の128kの情報を_バイト_から_人間_の言葉に変換する方法を学んで理解してみよう。
そして_ヴォワラ_(フランス語)問題解決。この小さなおかしなアイデアのためにEXIFデータたっぷりの写真が手に入った。実はずっとその写真は持ってたんだけど、宇宙の悪い位置情報探知者から俺を守ってくれてありがとう。そしてAppleにはPhotosから_「Finderで表示」_を削除してくれたことに再びお礼を。
「オリジナル」はどこ?
簡単な方法は_gif_を見ればわかる:
フォルダはあまり意味をなさないように見えるけど、数字を見れば月ごと、次に日付ごと、そして写真が入った謎の数字のフォルダという順番で作られているとわかる。だからEXIFデータの抽出にはそのファイルを使ってみよう。たぶんWindowsならこういう問題は起きないし、Linuxなら、まあ、このポストを読むより優れたプラグインを書いてるんじゃないか。
難しい方法は忘れよう。難しい方法でやりたいなら別にいいけど、簡単な方法でできるなら簡単にやればいい。それが友よ、人生の教訓だ。EXIF GPSデータの抽出についてじゃなくて、楽にやることについての。