Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Image uploading on iOS
Search
cockscomb
May 21, 2015
Programming
1.8k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Image uploading on iOS
Presented at 関西モバイルアプリ研究会 #2
cockscomb
May 21, 2015
More Decks by cockscomb
See All by cockscomb
はてなアカウント基盤 State of the Union
cockscomb
1
1.5k
jq at the Shortcuts
cockscomb
1
2.1k
GraphQL放談
cockscomb
4
2.2k
GraphQL Highway
cockscomb
28
8.9k
吉田を支える技術
cockscomb
0
2.6k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.5k
ユーザインターフェイスと非同期処理
cockscomb
5
2.1k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.8k
Other Decks in Programming
See All in Programming
iOSDC2026登壇資料.pdf
riofujimon
0
170
WebAssembly in Android Apps 〜 WASMはJNIの夢を見るか
keiji
1
110
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
1.9k
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
190
kubernetes コンポーネント開発入門 / 新卒N年目の勉強会&交流会!〜〇〇への誘い〜 #n_study
mazrean
0
240
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
2.8k
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
120
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
350
FreeBSDでZabbixを動かす
kenkino
0
300
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
100
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
Security issues being discussed on Web Platforms
petamoriken
0
960
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
109
250k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Darren the Foodie - Storyboard
khoart
PRO
4
3.9k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
380
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
The Limits of Empathy - UXLibs8
cassininazir
1
670
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
First, design no harm
axbom
PRO
2
1.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Transcript
iOSͰͷ ը૾Ξοϓϩʔυ
cockscomb
None
iOSͰͷ ը૾Ξοϓϩʔυ
ԿΛ͍·͞Β w J04ͷਐԽʹͬͯ࠷৽ͷख๏Λհ͍ͨ͠ w ϕετϓϥΫςΟεͰ͢
ը૾Ξοϓϩʔυͷखॱ 1IPUP-JCSBSZ͔ΒσʔλΛऔಘ ը૾ͷՃ ਖ਼͍͖͠ʹճస ඞཁͳαΠζʹॖখ
దͳܗࣜʹѹॖ Ξοϓϩʔυ
σʔλΛऔಘ • UIImagePickerController • UIImagePickerControllerOriginalImage • UIImagePickerControllerEditedImage • AssetsLibrary •
Photos
σʔλΛऔಘ let asset: PHAsset var originalData: NSData? var type: UTI?
var imageOrientation: UIImageOrientation = .Up let options = PHImageRequestOptions() options.synchronous = true options.version = .Current let imageManager = PHImageManager.defaultManager() imageManager.requestImageDataForAsset(asset, options: options) { (imageData, dataUTI, orientation, info) -> Void in originalData = imageData type = UTI(dataUTI) imageOrientation = orientation }
ը૾ͷՃ w 6*,JU w $PSF(SBQIJDT w $PSF*NBHF
ਖ਼͍͖͠ʹճస var image = CIImage(CGImage: originalImage) // See: kCGImagePropertyOrientation var
orientationValue: Int32 = 1 switch orientation { case .Up: break case .Down: orientationValue = 3 case .Left: orientationValue = 8 case .Right: orientationValue = 6 ... } image = image.imageByApplyingOrientation(orientationValue)
ඞཁͳαΠζʹॖখ var image: CIImage let scale: CGFloat = 0.5 let
lanczosResamplingFilter = CIFilter( name: "CILanczosScaleTransform", withInputParameters: [ "inputImage" : image, "inputScale" : scale, ]) image = lanczosResamplingFilter.outputImage
దͳܗࣜʹѹॖ let context = CIContext(options: [:]) let scaledImage = context.createCGImage(image,
fromRect: image.extent()) let processedData = NSMutableData() let destination = CGImageDestinationCreateWithData( processedData, type.UTIString, 1, nil) CGImageDestinationAddImage(destination, scaledImage, [ kCGImageDestinationLossyCompressionQuality as String : 0.8, ] as [ String : AnyObject ]) CGImageDestinationFinalize(destination)
Ξοϓϩʔυ w ϚϧνύʔτϦΫΤετͱ͔Ͱ w ͦΕͧΕ͕ΜΔ
ը૾Ξοϓϩʔυͷखॱ 1IPUP-JCSBSZ͔ΒσʔλΛऔಘ ը૾ͷՃ ਖ਼͍͖͠ʹճస ඞཁͳαΠζʹॖখ
దͳܗࣜʹѹॖ Ξοϓϩʔυ
ิ w શମΛNSOperationͷαϒΫϥεͳͲͰ࡞Δͱ Α͍ w $PSF*NBHFΛ͏ͱ͖ɺՄೳͳΒCIContext ͍ճ͢ͱΑ͍
iOSͰͷ ը૾Ξοϓϩʔυ