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 DATA라고 해요. 날짜, 시간, 그런 유용하고 중요한 논리적 데이터 외에도, 카메라_의 기술적 데이터도 많이 있어요. 노출, 초점 거리, 사진_에 관한 다른 재미있는 것들이요. 아마 셀카를 많이 찍는다면 이게 처음이자 마지막으로 듣는 이야기일 거예요.
요점으로
명확하게 말할게요. 친구 Marceliwi와 인생과 웹사이트에 대해 이야기하다가 아이디어 하나가 떠올랐어요 (뭔가 저그-하이브마인드 생각 같은). 그 _아이디어_에서 어느 순간, 칠레를 떠나기 전부터 머릿속에 있었던 것을 시도하게 됐어요. 사진에서 GPS 데이터를 가져와서 멋지고 디자인된 방식으로 표시하는 거요 (좁고 초가늘고 읽기 어려운 얇은 폰트에 드롭 쉐도우 같은 거).
사진에서 데이터 가져오기
요즘 Jekyll에 푹 빠져있고, 블로그에 돈 안 내는 것, frontmatter, github pages 제한 등을 생각하면 첫 번째이자 유일한 선택지는 JAVASCRIPT, 친구들한테는 JS예요.
구글 검색 조금 하니까 짠!!, 사진에서 EXIF 데이터를 가져오는 라이브러리를 만든 좋은 분이 있었어요. EXIF에 대한 많은 것을 설명하는 PDF까지 딸려 있었어요. 이걸 잘 문서화된 플러그인이라고 해요.
문제 도시에 오신 것을 환영합니다
플러그인 찾았어요. 손 더럽힐 시간이에요. 안녕, 내 이름은 NULL 이고 이쪽은 내 친구 UNDEFINED예요. 지난주 사진 하나를 꺼내서 위치를 가져오려고 했어요. 놀랍게도, 위치 없음… 그리고 뭐가 잘못됐는지 집착적으로 이해하려 한 게 누구냐면, 바로 저 (그건 _프랑스어_예요).
이게 어떻게 가능한 거야!?!?
재미있는 목소리로 혼자 말했어요.
Photos 앱에서 정보를 검색하니까 사진의 위치가 나오는 얘기하던 지도가 있었어요. 하지만 그 직전엔 제 작은 _Js 실험_에 아무것도 없었어요. 혹시 사진 문제인가 싶어서 또 시도하고, 또 하고, 또 하고, 또 하고, 이 쓸모없는 게 이 우주 뭐가 잘못된 거야!?!?!?
다시 구글로 돌아가서 답을 찾았지만, “gps 위치 사진 photos”로 답을 찾는 건 상당히 어려웠어요.
이 단락을 빌려 photos 앱에 사진이라는 정말 창의적인 이름을 붙여준 Apple에 다시 한번 감사를 전하고 싶어요.
한참 후 많은 시도 끝에, 어느 랜덤 블로그의 댓글이 어두운 내 인생에 빛을 가져다줬어요…
“The moment it is emailed or uploaded, all of that information is stripped.”
Sharri
이 랜덤한 분이 제 문제의 해결책을 줬어요. 보안 이유로, Flickr에 사진을 업로드하거나 Photos에서 다른 곳으로 사진을 복사할 때 사진에서 EXIF GPS Data가 제거된다는 거예요. _“된다는”_이라고 한 건 Photos 패키지 라이브러리 안의 원본 사진에서만 확인해봤기 때문이에요.
그런데 아무것도 설명 안 하잖아요 이 멍청이
맞아요, 지식에 굶주린 친구여, 여기서는 그냥 코드가 아닌 부분을 이야기하는 거예요. EXIF에 대해 더 알고 Flickr가 어떻게 모든 데이터를 가져오는지 이해하고 싶다면 이 엄청나게 긴 링크를 클릭하세요. EXIF의 첫 128k 정보를 바이트_에서 _인간 언어로 변환하는 방법을 배울 수 있어요.
그리고 짜잔 (그건 프랑스어) 문제 해결됐어요. 이제 이 작고 이상한 아이디어를 위한 EXIF DATA가 가득한 사진들이 있어요. 사실 항상 그 사진들을 갖고 있었지만, 우주의 악의적인 위치 검색자들로부터 제 인생을 보호해줘서 감사해요. 그리고 Photos에서 _“Finder에서 파일 보기”_를 제거해준 Apple에 또 감사를 전해요.
내 “원본”은 어디 있어요?
쉬운 방법, _gif_를 봐요:
폴더가 별 의미 없어 보여도, 숫자를 보면 월별로, 그다음 일별로, 그리고 사진이 들어있는 이상한 숫자로 만들어진 걸 알 수 있어요. EXIF DATA 추출을 위해 이 파일들을 사용해보세요. Windows라면 이런 종류의 문제는 없을 거고, Linux라면, 뭐, 이 포스트 읽는 것보다 더 좋은 플러그인을 짜고 있을 거예요.
어려운 방법은 잊어버려요. 쉬운 방법으로 할 수 있는데 왜 어려운 방법으로 하겠어요. 그게 친구들이여, 인생 교훈이에요. EXIF GPS DATA 추출이 아니라 쉽게 하는 것에 대한 교훈이요.
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データの抽出についてじゃなくて、楽にやることについての。