Python

PIL.ExifTags.TAGS: dict

1InteropIndex
11ProcessingSoftware
254NewSubfileType
255SubfileType
256ImageWidth
257ImageLength
258BitsPerSample
259Compression
262PhotometricInterpretation
263Thresholding
264CellWidth
265CellLength
266FillOrder
269DocumentName
270ImageDescription
271Make
272Model
273StripOffsets
274Orientation
277SamplesPerPixel
278RowsPerStrip
279StripByteCounts
280MinSampleValue
281MaxSampleValue
282XResolution
283YResolution
284PlanarConfiguration
285PageName
288FreeOffsets
289FreeByteCounts
290GrayResponseUnit
291GrayResponseCurve
292T4Options
293T6Options
296ResolutionUnit
297PageNumber
301TransferFunction
305Software
306DateTime
315Artist
316HostComputer
317Predictor
318WhitePoint
319PrimaryChromaticities
320ColorMap
321HalftoneHints
322TileWidth
323TileLength
324TileOffsets
325TileByteCounts
330SubIFDs
332InkSet
333InkNames
334NumberOfInks
336DotRange
337TargetPrinter
338ExtraSamples
339SampleFormat
340SMinSampleValue
341SMaxSampleValue
342TransferRange
343ClipPath
344XClipPathUnits
345YClipPathUnits
346Indexed
347JPEGTables
351OPIProxy
512JPEGProc
513JpegIFOffset
514JpegIFByteCount
515JpegRestartInterval
517JpegLosslessPredictors
518JpegPointTransforms
519JpegQTables
520JpegDCTables
521JpegACTables
529YCbCrCoefficients
530YCbCrSubSampling
531YCbCrPositioning
532ReferenceBlackWhite
700XMLPacket
4096RelatedImageFileFormat
4097RelatedImageWidth
4098RelatedImageLength
18246Rating
18249RatingPercent
32781ImageID
33421CFARepeatPatternDim
33422CFAPattern
33423BatteryLevel
33432Copyright
33434ExposureTime
33437FNumber
33723IPTCNAA
34377ImageResources
34665ExifOffset
34675InterColorProfile
34850ExposureProgram
34852SpectralSensitivity
34853GPSInfo
34855ISOSpeedRatings
34856OECF
34857Interlace
34858TimeZoneOffset
34859SelfTimerMode
34864SensitivityType
34865StandardOutputSensitivity
34866RecommendedExposureIndex
34867ISOSpeed
34868ISOSpeedLatitudeyyy
34869ISOSpeedLatitudezzz
36864ExifVersion
36867DateTimeOriginal
36868DateTimeDigitized
36880OffsetTime
36881OffsetTimeOriginal
36882OffsetTimeDigitized
37121ComponentsConfiguration
37122CompressedBitsPerPixel
37377ShutterSpeedValue
37378ApertureValue
37379BrightnessValue
37380ExposureBiasValue
37381MaxApertureValue
37382SubjectDistance
37383MeteringMode
37384LightSource
37385Flash
37386FocalLength
37387FlashEnergy
37388SpatialFrequencyResponse
37389Noise
37393ImageNumber
37394SecurityClassification
37395ImageHistory
37396SubjectLocation
37397ExposureIndex
37398TIFF/EPStandardID
37500MakerNote
37510UserComment
37520SubsecTime
37521SubsecTimeOriginal
37522SubsecTimeDigitized
37888AmbientTemperature
37889Humidity
37890Pressure
37891WaterDepth
37892Acceleration
37893CameraElevationAngle
40091XPTitle
40092XPComment
40093XPAuthor
40094XPKeywords
40095XPSubject
40960FlashPixVersion
40961ColorSpace
40962ExifImageWidth
40963ExifImageHeight
40964RelatedSoundFile
40965ExifInteroperabilityOffset
41483FlashEnergy
41484SpatialFrequencyResponse
41486FocalPlaneXResolution
41487FocalPlaneYResolution
41488FocalPlaneResolutionUnit
41492SubjectLocation
41493ExposureIndex
41495SensingMethod
41728FileSource
41729SceneType
41730CFAPattern
41985CustomRendered
41986ExposureMode
41987WhiteBalance
41988DigitalZoomRatio
41989FocalLengthIn35mmFilm
41990SceneCaptureType
41991GainControl
41992Contrast
41993Saturation
41994Sharpness
41995DeviceSettingDescription
41996SubjectDistanceRange
42016ImageUniqueID
42032CameraOwnerName
42033BodySerialNumber
42034LensSpecification
42035LensMake
42036LensModel
42037LensSerialNumber
42080CompositeImage
42081CompositeImageCount
42082CompositeImageExposureTimes
42240Gamma
50341PrintImageMatching
50706DNGVersion
50707DNGBackwardVersion
50708UniqueCameraModel
50709LocalizedCameraModel
50710CFAPlaneColor
50711CFALayout
50712LinearizationTable
50713BlackLevelRepeatDim
50714BlackLevel
50715BlackLevelDeltaH
50716BlackLevelDeltaV
50717WhiteLevel
50718DefaultScale
50719DefaultCropOrigin
50720DefaultCropSize
50721ColorMatrix1
50722ColorMatrix2
50723CameraCalibration1
50724CameraCalibration2
50725ReductionMatrix1
50726ReductionMatrix2
50727AnalogBalance
50728AsShotNeutral
50729AsShotWhiteXY
50730BaselineExposure
50731BaselineNoise
50732BaselineSharpness
50733BayerGreenSplit
50734LinearResponseLimit
50735CameraSerialNumber
50736LensInfo
50737ChromaBlurRadius
50738AntiAliasStrength
50739ShadowScale
50740DNGPrivateData
50741MakerNoteSafety
50778CalibrationIlluminant1
50779CalibrationIlluminant2
50780BestQualityScale
50781RawDataUniqueID
50827OriginalRawFileName
50828OriginalRawFileData
50829ActiveArea
50830MaskedAreas
50831AsShotICCProfile
50832AsShotPreProfileMatrix
50833CurrentICCProfile
50834CurrentPreProfileMatrix
50879ColorimetricReference
50931CameraCalibrationSignature
50932ProfileCalibrationSignature
50934AsShotProfileName
50935NoiseReductionApplied
50936ProfileName
50937ProfileHueSatMapDims
50938ProfileHueSatMapData1
50939ProfileHueSatMapData2
50940ProfileToneCurve
50941ProfileEmbedPolicy
50942ProfileCopyright
50964ForwardMatrix1
50965ForwardMatrix2
50966PreviewApplicationName
50967PreviewApplicationVersion
50968PreviewSettingsName
50969PreviewSettingsDigest
50970PreviewColorSpace
50971PreviewDateTime
50972RawImageDigest
50973OriginalRawFileDigest
50974SubTileBlockSize
50975RowInterleaveFactor
50981ProfileLookTableDims
50982ProfileLookTableData
51008OpcodeList1
51009OpcodeList2
51022OpcodeList3
51041NoiseProfile

|

[Python]TTC(TrueType フォントコレクション)フォントの収録書体数(INDEX)を取得する(その2)

FontLabでTTCフォント見るとこんな感じ

Screencapture_932x452_20211107111922

これを、取得したいわけです。



まずは準備
【1】エディタはVisual Studio Code https://code.visualstudio.com
【2】Visual Studio Code Python 拡張機能
https://marketplace.visualstudio.com/items?itemName=ms-python.python
【3】pipの package installer for Pythonのアップデート
ターミナルで
/usr/bin/python3 -m pip install --upgrade pip
【4】Pillow Library
https://pillow.readthedocs.io/en/stable/installation.html
インストール ターミナルで
/usr/bin/python3 -m pip install Pillow
【5】Pillow アップデート
/usr/bin/python3 -m pip install --upgrade Pillow
これで準備完了


で 色々やって(Pythonホントビギナー以下だからね…私は)
こんな感じで TTCのINDEX番号と書体名を取得出来るようになりました

ダウンロード - getttcindex.py.zip

Screencapture_1368x1276_202111071151202


  1. #!/usr/bin/env python3
  2. # coding: utf-8
  3. from PIL import Image, ImageDraw, ImageFont
  4. import os
  5. setFontFile = "/System/Library/Fonts/STHeiti Light.ttc"
  6. theFileName = os.path.basename(setFontFile)
  7. numIndex = int(0)
  8. setFontFile = str(setFontFile)
  9. theDelimiters = ','
  10. listJoinName = ''
  11. objFont = ImageFont.truetype(setFontFile, 32)
  12. theName = objFont.font_variant(index=numIndex).getname()
  13. while True:
  14.   try:
  15.    objFont = ImageFont.truetype(setFontFile, 32)
  16.    theName = objFont.font_variant(index=numIndex).getname()
  17.    theName0 = str(theName[0])
  18.    theName1 = str(theName[1])
  19.    theJoinName = ''.join(theName0 + ' ' + theName1)
  20.    listJoinName = listJoinName + theDelimiters + theJoinName
  21.    numIndex = numIndex + 1
  22.   except:
  23.    break
  24. pass
  25. listJoinName = listJoinName[1:]
  26. listJoinName = listJoinName.split(",")
  27. numIndex = str(numIndex)
  28. print ("このフォントに内包されている書体数:" + numIndex)
  29. numIndex = int(numIndex)
  30. for i in range(numIndex):
  31.      theTyepName = listJoinName[i]
  32.      theIndexNo = str(i)
  33.      print ("INDEX番号:" + theIndexNo)
  34.      print ("このフォントに内包されている書体名:" + theTyepName)

|

[Python]TTC(TrueType フォントコレクション)フォントの収録書体数(INDEX)を取得する(その1)

M1+OS12環境になったので
TTCフォントに『何書体』収納されているか?確認する方法が無くなった…
OTMASTERが動作しない https://www.fontmaster.nl
FontLab買おうかな… https://www.fontlab.com/



スポットライトコマンドのmdlsで取得できる『はず』なのだが…
com_apple_ats_name_postscript = (
".HiraginoSansGBInterface-W3",
".HiraginoSansGBInterface-W6",
"HiraginoSansGB-W3",
"HiraginoSansGB-W6"



macOS12のシステムフォントの『クレー』等
/System/Library/AssetsV2/com_apple_MobileAsset_Font7/配下は
スポットライトのインデックスされないので
mdls /System/Library/AssetsV2/com_apple_MobileAsset_Font7/e435ef28885d2cfd68f2a4330023bd89e339c304.asset/AssetData/Klee.ttc
kMDItemFSContentChangeDate = 2021-08-30 18:08:10 +0000
kMDItemFSCreationDate = 2021-08-30 18:08:10 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = 0
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = 0
kMDItemFSLabel = 0
kMDItemFSName = "Klee.ttc"
kMDItemFSNodeCount = 14873176
kMDItemFSOwnerGroupID = 242
kMDItemFSOwnerUserID = 242
kMDItemFSSize = 14873176
kMDItemFSTypeCode = ""

てな、結果になり
環境依存が発生する(まぁ…スポットライトですから)
exif使うのもありますが、それは、それで、作者次第
AppleScript経由だと『黒体(STHeiti)』のようなフォントがどうしてもうまくいかない。
『言語(スクリプト)』が違う2書体が内包されていて
ファミリー名が違う2書体を、取得する方法が思い浮かばない…

Screencapture_1946x644_20211107111922

続く

|

その他のカテゴリー

Accessibility AccessibilityCheck AccessibilityForm AccessibilityInDesign AccessibilityPDF Acrobat Acrobat Action Acrobat Annotation Acrobat AppleScripts Acrobat Character Acrobat Layer Acrobat PDF Embed API Acrobat PDF Form Print Acrobat Plug-ins Acrobat Portfolios Acrobat Print AcrobatBarcode AcrobatDialog AcrobatForm AcrobatJS AcrobatMenu AcrobatPDF AcrobatStamp AcrobatYouTube AddressBook Adobe Adobe InDesign Adobe Photoshop AdobeAppleScript AdobeBridge AdobeIllustrator AdobeJSX aed Alfresco Android AnimationGif Apple Apple Support AppleScript AppleScriptBasics AppleScriptCharacter AppleScriptColor AppleScriptDroplet AppleScriptErrorNum AppleScriptFolder AppleScriptFontBook AppleScriptRename AppleScriptTools AppleSymbols Applications Barcode Barcode2D BarcodePostal BetterHTMLExport Book BOX Browser buzz Certificates CharacterEntity CharacterSets Colors Cool Site CSS Cutting DecoMail DecorationMail Design Desktop Diff DJ dmg DNS Documents Download DTP eBook Editer eMail Envelopes ExifTool Facebook FFmpeg File System Fonts FontsTool FontsWeb FOOD FormPrint ftp Gadget Gif Animation Google Google Chrome Enterprise HexEditor HTML info iPhoto ISBN ISO iTunes iWork iWorkNumbers iWorkNumbersCalendar iWorkNumbersTimecard iWorkPages JavaScript JeditX JeditX Regexp JeditXAppleScript JIS jquery Letterpress Library logo Mac Admin Mac Archiver Mac Browser Mac Browser Plugin Mac QuickLook Mac Setup Mac Spotlight Mac Video Map Memo Microsoft Teams Mobby mobileconfig Moto Movies Music Network Basic ntp OCR Office OfficePowerPoint OSX Paint Pantone Paper PDFlib Permission Photo Pictograms Print Public Python QuickLook QuickTime QuickTimeSetting QuickTimeSound Real Media ReName ResourceFork ruby Sample Screen ScreenCast Search Security SEO Sharing SLAResource Sound Spotlight Stamp SWF TCC.db Tutorial PSD TV Twitter Typography Unicode Utilities Video WEB APP WebFont Wedding Windows WindowsMedia XML XMP XPS YouTube YouTube Rss