v_kyr Posted February 3, 2023 Posted February 3, 2023 Here's another Python3 script whatFileType.py which can be helpful in situations, where some files don't have file extensions, or where you maybe can't trust a files initial shown file extension (...like an binary image file download without extension etc.). So this little whatFileType.py Python 3 script does basically here what the Unix file cmd, or some services like what file is do, it tells you what sort of file it is. BTW this script can also tell if some binary file is an Affinity file. The actual supported and recognized file signatures are: BMP, JPG, GIF, PNG, TIFF, PSD, PDF, WEBP, AFFINITY, EPS, RTF, HDR, EXR ... which are mostly those file formats Affinity apps export or save to. The whatFileType.py script can be called either by passing over some file as an argument directly ... Quote > python3 whatFileType.py filename ... or in an interacting mode just like this ... Quote > python3 whatFileType.py Enter a filename to identify or press ENTER to skip: test Selecting file... test Opening file: test File size: 1001678 Bytes Trying to identify file signature: AFFINITY In cases where some file type is unrecognized (thus not supported yet) the script tells you ... Quote > python3 whatFileType.py unknown_check.txt Selecting file...unknown_check.txt Opening file: unknown_check.txt File size: 451 Bytes Trying to identify file signature: unrecognized file signature! Here's the whatFileType.py Python3 script for download: whatFileType.py Have fun! loukash and walt.farrell 1 1 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Paul Mudditt Posted February 3, 2023 Posted February 3, 2023 Nice!, now just need to detect whether Affinity V1 or V2 for this chap? Affinity Rat and DEWLine 2 Quote Affinity Photo, Designer, Publisher 1.10 and 2.6 on macOS 15.4 Beta Sequoia on M1 Mac Mini 16GB 1TB Affinity Photo, Designer, Publisher 1.10 and 2.6 on Windows 10 Pro. (revived !) Affinity Photo, Designer, Publisher 2.6 on M1 iPad Pro 11” on iPadOS beta 18.4 Recommended Fan based Affinity Support Groups on Facebook https://www.facebook.com/groups/AffinityForiPad https://www.facebook.com/groups/AffinityPhoto/ https://www.facebook.com/groups/affinityphotoastrophotography The hardest link to find https://affinity.help Mud’s Macros Library:- https://forum.affinity.serif.com/index.php?/topic/156842-muds-macros-v11-library-content-aware-move-added/
walt.farrell Posted February 3, 2023 Posted February 3, 2023 It's unclear from the current description what "Affinity file" means. There are the obvious 3 main native types for Publisher, Designer, and Photo, of course. But what about afbrush, afassets, etc. files? DEWLine 1 Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
v_kyr Posted February 3, 2023 Author Posted February 3, 2023 5 hours ago, Paul Mudditt said: ...now just need to detect whether Affinity V1 or V2 for this chap? Well, sure that would be useful to detect, but I don't know yet if and where that information is hidden (...binary hex position wise) inside the Affinity format binary files. I also don't have any equal V2 to V1 files here in order to hunt after that via hex editor file compares. - So all in all it's probably not that easy to find out by such an proprietary completely undocumented file format. Paul Mudditt 1 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Paul Mudditt Posted February 3, 2023 Posted February 3, 2023 25 minutes ago, walt.farrell said: It's unclear from the current description what "Affinity file" means. There are the obvious 3 main native types for Publisher, Designer, and Photo, of course. But what about afbrush, afassets, etc. files? Hi Walt, there are not 3 main native types, there is only one file format for V1 and one file format for V2, there is zero difference in contents for a .afdesign, .afphoto, .afpub file other than the text used in the file extension. The file extension is a mere visual reminder where you saved it from and does not signify any different contents. For example, this why .afpub files can be opened in Photo or Designer as a native file import. Photo would not even know that it opened a file created in .afpub. loukash, walt.farrell and v_kyr 2 1 Quote Affinity Photo, Designer, Publisher 1.10 and 2.6 on macOS 15.4 Beta Sequoia on M1 Mac Mini 16GB 1TB Affinity Photo, Designer, Publisher 1.10 and 2.6 on Windows 10 Pro. (revived !) Affinity Photo, Designer, Publisher 2.6 on M1 iPad Pro 11” on iPadOS beta 18.4 Recommended Fan based Affinity Support Groups on Facebook https://www.facebook.com/groups/AffinityForiPad https://www.facebook.com/groups/AffinityPhoto/ https://www.facebook.com/groups/affinityphotoastrophotography The hardest link to find https://affinity.help Mud’s Macros Library:- https://forum.affinity.serif.com/index.php?/topic/156842-muds-macros-v11-library-content-aware-move-added/
walt.farrell Posted February 3, 2023 Posted February 3, 2023 17 minutes ago, Paul Mudditt said: there are not 3 main native types, That's of course true, Paul, and I must apologize for my imprecise wording. My main point was that there are many types of "Affinity files" (some with subtypes): afassets, afstyles, afbrushes (raster and vector), affont, afshortcut, afselection (if I remember correctly), and probably several I'm not remembering at the moment. Thus, "Affinity" is not an ideal descriptor for a file type, and it's not clear (without reading the Python code, which I have not done yet, and looking at the hex for these files), what "Affinity" means in this context. Paul Mudditt 1 Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
Paul Mudditt Posted February 3, 2023 Posted February 3, 2023 19 minutes ago, walt.farrell said: That's of course true, Paul, and I must apologize for my imprecise wording. My main point was that there are many types of "Affinity files" (some with subtypes): afassets, afstyles, afbrushes (raster and vector), affont, afshortcut, afselection (if I remember correctly), and probably several I'm not remembering at the moment. Thus, "Affinity" is not an ideal descriptor for a file type, and it's not clear (without reading the Python code, which I have not done yet, and looking at the hex for these files), what "Affinity" means in this context. Ah gotcha Walt, now I follow you. Apologies. Quote Affinity Photo, Designer, Publisher 1.10 and 2.6 on macOS 15.4 Beta Sequoia on M1 Mac Mini 16GB 1TB Affinity Photo, Designer, Publisher 1.10 and 2.6 on Windows 10 Pro. (revived !) Affinity Photo, Designer, Publisher 2.6 on M1 iPad Pro 11” on iPadOS beta 18.4 Recommended Fan based Affinity Support Groups on Facebook https://www.facebook.com/groups/AffinityForiPad https://www.facebook.com/groups/AffinityPhoto/ https://www.facebook.com/groups/affinityphotoastrophotography The hardest link to find https://affinity.help Mud’s Macros Library:- https://forum.affinity.serif.com/index.php?/topic/156842-muds-macros-v11-library-content-aware-move-added/
v_kyr Posted February 3, 2023 Author Posted February 3, 2023 45 minutes ago, walt.farrell said: My main point was that there are many types of "Affinity files" (some with subtypes): afassets, afstyles, afbrushes (raster and vector), affont, afshortcut, afselection (if I remember correctly), and probably several I'm not remembering at the moment. They do mostly all start with the same signature (BOM) here, and as we always already often said in the forum, the Affinity file format(s) are sadly proprietary and undocumented, thus it's difficult to tell if there are maybe overall some deeply internal hidden differences here between the file formats the Affinity apps do write out (aka afphoto, afdesign, afpublish, afassets, afbrushes ... etc.), in order to differntiate between them. And to make it clear here ALL these Affinity related files do always start with the same signature (BOM), thus this script so far can just tell that it is an (some kind of) "AFFINITY" file! - If you encounter more informations about possible by Affinity generated file format differences and how to differntiate between them, I will happily take those into account here for this script! Paul Mudditt and walt.farrell 1 1 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
walt.farrell Posted February 3, 2023 Posted February 3, 2023 Thanks, @v_kyr. Meanwhile, if it helps with the V1 vs V2 detection request, here are empty V1 and V2 files, both based on the Letter Preset: empty-v2.afdesignempty-v1.afdesign v_kyr 1 Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. Laptop 2: Windows 11 Pro 24H2, 16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU iPad: iPad Pro M1, 12.9": iPadOS 18.3.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.0.1
v_kyr Posted February 3, 2023 Author Posted February 3, 2023 BTW, in the meantime I've added EXR and HDR file signature support to the whatFileType.py Python 3 script. walt.farrell 1 Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.