If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#121
|
|||
|
|||
Image formats
nospam wrote:
In article , mechanic wrote: One day file extensions will be outdated and machines will work out how to display the data from a file without the preconception inherent in assigning a file extension. that day was back in 1984 with the original macintosh and classic mac os, which did not use file extensions. mac os x, being based on unix, does use extensions. No we don't need extensions in UNIX, yes we do. change the extension and things break. for example, rename a .tar.gz to .jpg, a .html to .png., a .pdf to .cc, or remove the extension entirely and see how well it works out for you. You have to know what you're doing, for that to work. Rename a .tar.gz to .jpg. Open your File Manager (nemo, thunar, nautilus, ...). Right click the file, and the item showing will be two instances of "Archive Manager". Archive Manager will "mount" the mis-named file as a .tar.gz in the same way as Windows cabview.dll will show the contents of a cab file. Once you've navigated to the bottom of the Archive Manager mount, you can interact with whatever file is in there. If you force the issue, like doing something stupid (in other words, you intentionally avoid the automation protecting you) vlc some.tar.gz then VLC will likely tell you that it has nothing to parse or view that with. You do not expect VLC to have an entire File Manager inside and a running copy of the "file" command, to out-think you. VLC is not going to say "I sniffed that, and the output of /bin/file tells me you would have better luck with a gzip pipe". If you force-feed VLC like that, it's just going to yap back at you that it cannot read the file. File extensions remain in either system, as a "suggested serving". You can invent additional steps in the computing process, to consider that style of metadata extension, but it is not trusted, and eventually the parser on some application ultimately gets to decide whether anything is going to happen. If you do vlc some.tar.gz VLC does not go "OK, OK, already, I'm eating this, here's your video", while on the screen you see random colored dots caused by trying to display a ZIPped file on the screen. Software used to do stupid **** like that long long ago, but we've long since surpassed the "naive loading" approach. Programs usually need to parse a bit of the file (say, a length field), before they can be coerced into stupid stuff. The closest you'll get to "loading garbage" these days, is in cryptography. And there are probably sufficient protections after an attempted decryption, to tell that the file was not a candidate in the first place. Paul |
Ads |
#122
|
|||
|
|||
Image formats
In article , Paul
wrote: No we don't need extensions in UNIX, yes we do. change the extension and things break. for example, rename a .tar.gz to .jpg, a .html to .png., a .pdf to .cc, or remove the extension entirely and see how well it works out for you. You have to know what you're doing, for that to work. changing an extension does not change the underlying format. a tar.gz that has been renamed to jpg is still a tar.gz. it is not a jpeg. renaming a .jpg to a .gif is still a jpeg. you can sometimes force apps to open it anyway, but not always and certainly not by double-clicking. it *will* cause problems. |
#123
|
|||
|
|||
Image formats
nospam wrote:
In article , Paul wrote: No we don't need extensions in UNIX, yes we do. change the extension and things break. for example, rename a .tar.gz to .jpg, a .html to .png., a .pdf to .cc, or remove the extension entirely and see how well it works out for you. You have to know what you're doing, for that to work. changing an extension does not change the underlying format. a tar.gz that has been renamed to jpg is still a tar.gz. it is not a jpeg. renaming a .jpg to a .gif is still a jpeg. you can sometimes force apps to open it anyway, but not always and certainly not by double-clicking. it *will* cause problems. Not in File Manager. And in the GUI cosmos, that's what you're supposed to be using. File Manager knows what that is, and will present the correct application (Archive Manager). There's a reason you can't (easily) find Terminal in Linux distros. That's the reason. To wean newcomers off command line invocations. Paul |
#124
|
|||
|
|||
Image formats
In article , Paul
wrote: No we don't need extensions in UNIX, yes we do. change the extension and things break. for example, rename a .tar.gz to .jpg, a .html to .png., a .pdf to .cc, or remove the extension entirely and see how well it works out for you. You have to know what you're doing, for that to work. changing an extension does not change the underlying format. a tar.gz that has been renamed to jpg is still a tar.gz. it is not a jpeg. renaming a .jpg to a .gif is still a jpeg. you can sometimes force apps to open it anyway, but not always and certainly not by double-clicking. it *will* cause problems. Not in File Manager. that doesn't interpret the contents of the file. And in the GUI cosmos, that's what you're supposed to be using. File Manager knows what that is, and will present the correct application (Archive Manager). not always. it can 'work' if the underlying format is the same. you could, for example, write raw html into a .txt file, then rename it as .html and continue editing it or put it on a server, but that's only because both are plain text. There's a reason you can't (easily) find Terminal in Linux distros. That's the reason. To wean newcomers off command line invocations. separate issue. |
#125
|
|||
|
|||
Image formats
"J. P. Gilliver (John)" on Thu, 20 Feb 2020
13:52:44 +0000 typed in alt.windows7.general the following: Another odd thing about RTF: I don't know what it is, but the display always looks cheap to me. Fonts are not crisp looking. Color options are limited unless you customize the code. Not as polished as other file formats. I know what you mean! It used to have the advantage that at least anyone with Windows could edit it, as (I think) it's the native format of Wordpad, which comes with Windows (and for a "free" WP is a lot better than it's given credit for - in fact, if it wasn't for compatibility issues, I'd say is sufficient for many users' needs). And there are people who _don't_ have Office (or one of the free alternatives - people who aren't computerate enough to get one). But Word, in at least some cut-down form, is now tending to be on all (Windows anyway) machines, so that's less relevant than it used to be. I like RTF and the old Wordpad. Quick, "easy" cut and paste and save most of the formatting. But feeping creaturism means that the simple program of old, gets more and more features, until it is no longer quick to load, use or .... some days's I'd like to have the source code for some of the 16 & 32 bit programs and just compile it for a 64 bit OS. "Not like the old days!" if 640KB was good enough for Bill Gates --- what the hell am I saying? -- pyotr filipivich Next month's Panel: Graft - Boon or blessing? |
#126
|
|||
|
|||
Image formats
"Mayayana" on Wed, 19 Feb 2020 22:55:36
-0500 typed in alt.windows7.general the following: "J. P. Gilliver (John)" wrote | I use the free plugins Microsoft issued to allow Office 2003 to read *x | files. (I agree that there's little _need_for .docx to exist - but sadly | it's becoming increasingly "supported", in that I am receiving more and | more of them.) I don't see any point to .doc, either, in most cases. Word processors are for writing business letters that will be printed. I actually keep a script on my desktop to convert doc to txt. Cool. "Back in the day" I had a small program which stripped out the unprintable characters. Where it is, I've no idea. -- pyotr filipivich Next month's Panel: Graft - Boon or blessing? |
#127
|
|||
|
|||
Image formats
nospam on Thu, 20 Feb 2020 08:12:39 -0500
typed in alt.windows7.general the following: In article , mechanic wrote: One day file extensions will be outdated and machines will work out how to display the data from a file without the preconception inherent in assigning a file extension. that day was back in 1984 with the original macintosh and classic mac os, which did not use file extensions. mac os x, being based on unix, does use extensions. As I recall from the late 80's, the "advantage" of Unix is it treats everything as a file: keyboard, monitor, files, output. A file might have a extension to let humans know what type of contents to expect, but the system was perfectly "happy" to open a (text) file with a (music program) file. Not going to say the result would be good, mind you, but the system did no hand holding. type rm -rf * at the prompt and there's no "Do you mean to do that? Y/N" - your files are gone. OTOH, C let you add letters, so that was useful. -- pyotr filipivich Next month's Panel: Graft - Boon or blessing? |
#128
|
|||
|
|||
Image formats
pyotr filipivich wrote:
"Mayayana" on Wed, 19 Feb 2020 22:55:36 -0500 typed in alt.windows7.general the following: "J. P. Gilliver (John)" wrote | I use the free plugins Microsoft issued to allow Office 2003 to read *x | files. (I agree that there's little _need_for .docx to exist - but sadly | it's becoming increasingly "supported", in that I am receiving more and | more of them.) I don't see any point to .doc, either, in most cases. Word processors are for writing business letters that will be printed. I actually keep a script on my desktop to convert doc to txt. Cool. "Back in the day" I had a small program which stripped out the unprintable characters. Where it is, I've no idea. https://stackoverflow.com/questions/...om-a-unix-file I think Windows has a strings program too :-) When using this to scan EXE files, set the -n to a larger value like maybe 10 or 12 or something. There's a lot of 4 character junk in files which the "default" value will pick up. Cranking the value of N a tiny bit, really helps performance. I see this also has a Unicode option (for Unicode-only I would guess). https://docs.microsoft.com/en-us/sys...nloads/strings Paul |
#129
|
|||
|
|||
Image formats
"J. P. Gilliver (John)" wrote | Interesting. (My old Turnpike can handle truly embedded-in-the-text | images in email and news postings, but hardly any [I don't know of any] | other mail/news clients can, so I've learnt to attach any images - or | other attachments - at the end when sending. [Other clients _appear_ to | embed images in text, but they actually put them at the end, putting a | _link_ - such as "cid:" - in the text where the image is to go. Or, of | course, these days, don't include the image at all, but a link to its | location online.]) I hadn't known about the ability of HTML to embed | images: is that HTML 6 or something? It's been around for a long time, but it's not in big demand. However, I think IE has only handled something like 32 KB. Though the latest version might work better. It goes like this: IMG WIDTH=800 HEIGHT=64 SRC="data:image/gif;base64,xxxxxx" / The xxxxxx is the base64 encoding. It can also be used in CSS. |
#130
|
|||
|
|||
Image formats
"J. P. Gilliver (John)" wrote
| I think you're going a bit too far in totally dismissing word processing | (or dismissing it for private use). I don't distinguish "private" use. I use it for my own business receipts and contracts. I use it when I need to print a page with formatting, logo, etc. But for most things I don't need that. I have lots of articles I've saved from online as TXT. I don't need images. I don't need formatting. Just text, the same it would be if I were reading in a newspaper or magazine. And have you noticed the images with webpages these days? They generally use free, stock images that add nothing to the article. | Presumably your script fails for some characters - I don't mean just | accents, but for example where someone's used Wingdings - "J" for smiley | (you probably hate those too), and ")" instead of "Tel:", for example. What kind of nut would use wingdings? |
#131
|
|||
|
|||
Image formats
In message , Mayayana
writes: "J. P. Gilliver (John)" wrote [] | location online.]) I hadn't known about the ability of HTML to embed | images: is that HTML 6 or something? It's been around for a long time, but it's not in big demand. However, I think IE has only handled something like 32 KB. Though the latest version might work better. It goes like this: IMG WIDTH=800 HEIGHT=64 SRC="data:image/gif;base64,xxxxxx" / The xxxxxx is the base64 encoding. It can also be used in CSS. So you mean the encoded image follows the comma (does it need a newline after the comma?), and is followed by '" /' (without the '')? -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Time is an illusion - lunchtime doubly so. (First series, fit the first.) |
#132
|
|||
|
|||
Image formats
In message , Mayayana
writes: [] I don't distinguish "private" use. I use it for my own business receipts and contracts. I use it when I need to print a page with formatting, logo, etc. But for most things I don't need that. I have lots of articles I've saved from online as TXT. I don't need images. I don't need formatting. Just text, the same it would be if I were reading in a newspaper or magazine. Newspapers and magazines use italic, fonts - even images, for that matter! Even bold and underline, though granted not as much as WP documents. And have you noticed the images with webpages these days? They generally use free, stock images that add nothing to the article. I don't disagree with that. | Presumably your script fails for some characters - I don't mean just | accents, but for example where someone's used Wingdings - "J" for smiley | (you probably hate those too), and ")" instead of "Tel:", for example. What kind of nut would use wingdings? It's pretty universal these days - been with Windows since at least '95, I think - so why not use it? It contains a lot of genuinely useful symbols, and being TrueType they scale nicely. The example above is a trivial one: using ")" in Wingdings will give a little telephone symbol, which some people like to use as just a little light relief before their telephone number. -- J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf Time is an illusion - lunchtime doubly so. (First series, fit the first.) |
#133
|
|||
|
|||
Image formats
"J. P. Gilliver (John)" wrote
| IMG WIDTH=800 HEIGHT=64 SRC="data:image/gif;base64,xxxxxx" / | | The xxxxxx is the base64 encoding. It can also be used in | CSS. | So you mean the encoded image follows the comma (does it need a newline | after the comma?), and is followed by '" /' (without the '')? Exactly like above. No spaces within SRC. The 6 x's represent the base-64 code. The CSS version is a bit different, but not so relevant for most cases. Here's the entire drag-drop .vbs script, in case anyone wants it. It will handle JPG, GIF, PNG, putting the entire IMG tag on the clipboard for pasting. The usual caveats apply: * Watch out for wordwrap. Unlike JS and HTML, VBS recognizes line returns. They mark the end of a code statement. So, for example, the long list of numbers in the array for generating base-64 need to be all on one line. Ditto for the long lines after MsgBox and any comments that wrap. * Drag-drop may run into restrictions on Vista+. * God knows what Win10 will allow. For all I know it may just pop up a message box that says, "Buy this script at the Windows Store! And click here to see a free preview of Frozen2, also available at the Windows Store!! Need more toilet paper? We've got it!!! At the Windows Store!!!" '-- begin script ------------------- Dim ImInf, Arg, Ret Arg = WScript.Arguments(0) If Len(Arg) = 0 Then MsgBox "Drop a JPG, GIF, or PNG onto script to get a data URI IMG tag. The pre-prepared tag, with image converted to base64 encoding, will be put on the Clipboard for pasting.", 64 WScript.Quit End If Set ImInf = New ImageInfo Ret = ImInf.LoadImage(Arg) If Ret 0 Then MsgBox "IMG tag on clipboard. Total size of Base64 image is " & ImInf.Size & " bytes. IE8 will clip an image at 32 bytes. Other browsers have no realistic limit.", 64 Else MsgBox "Invalid extension: " & ImInf.Extension End If Set ImInf = Nothing '------------------------------------------------------------------------------- Class ImageInfo Private IE, TA, iWidth8, iHeight8, sExt8, Qt8, PPI, LenPic, FSO1 Public Property Get Width() Width = iWidth8 End Property Public Property Get Height() Height = iHeight8 End Property Public Property Get Extension() Extension = sExt8 End Property Public Property Get Size() Size = LenPic End Property Public Function LoadImage(sImgPath) Dim OPic, LRet LoadImage = 0 iWidth8 = 0 iHeight8 = 0 On Error Resume Next Pt8 = InStrRev(sImgPath, ".") sExt8 = LCase(Right(sImgPath, len(sImgPath) - Pt8)) Select Case sExt8 Case "gif", "jpg", "jpeg" Set OPic = LoadPicture(sImgPath) iWidth8 = CInt((PPI * OPic.width) / 2540) iHeight8 = CInt((PPI * OPic.height) / 2540) Set OPic = Nothing Case "png" LRet = GetPNGSpecs(sImgPath) If LRet = 0 Then LoadImage = 0 Exit Function End If Case Else LoadImage = 0 '-- not a web image. Exit Function End Select SetIMGTag sImgPath If iWidth8 0 Then LoadImage = 1 End Function '-- LoadPicture doesn't handle PNG. fortunately, W/H are easy to get from PNG. Private Function GetPNGSpecs(ImgPath) Dim TS1, s1, A2(23), i2 On Error Resume Next Set TS1 = FSO1.OpenTextFile(ImgPath) s1 = TS1.Read(24) TS1.Close Set TS1 = Nothing For i2 = 1 to 24 A2(i2 - 1) = Asc(Mid(s1, i2, 1)) Next If A2(0) 137 Then Exit Function If A2(1) 80 Then Exit Function 'P If A2(2) 78 Then Exit Function 'N If A2(3) 71 Then Exit Function 'G iWidth8 = (256 * A2(18)) + A2(19) iHeight8 = (256 * A2(22)) + A2(23) If iWidth8 0 Then GetPNGSpecs = 1 End Function '------------------------------------------------------------------------------ Private Sub SetIMGTag(sImg) Dim sTag, TS1, OFil1, LSz, sIn, sOut If iWidth8 = 0 Then Exit Sub sTag = "IMG WIDTH=" & CStr(iWidth8) & " HEIGHT=" & CStr(iHeight8) sTag = sTag & " SRC=" & Qt8 & "data:image/" & sExt8 & ";base64," Set OFil1 = FSO1.GetFile(sImg) LSz = OFil1.Size Set OFil1 = Nothing Set TS1 = FSO1.OpenTextFile(sImg) sIn = TS1.Read(LSz) TS1.Close Set TS1 = Nothing sOut = ConvertToBase64(sIn) LenPic = Len(sOut) sTag = sTag & sOut & Qt8 & " /" '--put the IMG tag on the clipboard. Set TA = IE.document.getElementById("T1") TA.value = sTag TA.Select Set TA = Nothing IE.ExecWB 12, 0 End Sub Private Function ConvertToBase64(sBytes) Dim B2(), B76(), ABytes(), ANums Dim i1, i2, i3, LenA, NumReturns, sRet On Error Resume Next ANums = Array(65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47) LenA = Len(sBytes) '-- convert each string character to ASCII value. ReDim ABytes(LenA - 1) For i1 = 1 to LenA ABytes(i1 - 1) = Asc(Mid(sBytes, i1, 1)) Next '-- generate base 64 equivalent in array B2. ReDim Preserve ABytes(((LenA - 1) \ 3) * 3 + 2) ReDim Preserve B2((UBound(ABytes) \ 3) * 4 + 3) i2 = 0 For i1 = 0 To (UBound(ABytes) - 1) Step 3 B2(i2) = ANums(ABytes(i1) \ 4) i2 = i2 + 1 B2(i2) = ANums((ABytes(i1 + 1) \ 16) Or (ABytes(i1) And 3) * 16) i2 = i2 + 1 B2(i2) = ANums((ABytes(i1 + 2) \ 64) Or (ABytes(i1 + 1) And 15) * 4) i2 = i2 + 1 B2(i2) = ANums(ABytes(i1 + 2) And 63) i2 = i2 + 1 Next For i1 = 1 To i1 - LenA B2(UBound(B2) - i1 + 1) = 61 ' add = signs at end if necessary. Next For i1 = 0 to UBound(B2) B2(i1) = Chr(B2(i1)) Next sRet = Join(B2, "") ConvertToBase64 = sRet End Function Sub Class_Initialize() Qt8 = Chr(34) Set IE = WScript.CreateObject("InternetExplorer.Application ") Set FSO1 = CreateObject("Scripting.FileSystemObject") IE.silent = True IE.Navigate "about:blank" While(IE.ReadyState 4) WScript.Sleep 20 Wend IE.document.body.innerHTML = "TEXTAREA ID=" & Chr(34) & "T1" & Chr(34) & " wrap=off/TEXTAREA" PPI = IE.document.parentWindow.screen.logicalXDPI End Sub Sub Class_Terminate() IE.Quit Set IE = Nothing Set FSO1 = Nothing End Sub End Class |
#134
|
|||
|
|||
Image formats
"J. P. Gilliver (John)" wrote
| Newspapers and magazines use italic, fonts - even images, for that | matter! Even bold and underline, though granted not as much as WP | documents. Yes. Save them if you find them useful. I don't. Most webpages are so badly designed these days that I just read articles with CSS disabled, anyway. 13px Verdana. About the same that I use in Notepad. So reading the article in Notepad is usually more comfortable for me. | What kind of nut would use wingdings? | | It's pretty universal these days - been with Windows since at least '95, | I think - so why not use it? It contains a lot of genuinely useful | symbols, and being TrueType they scale nicely. The example above is a | trivial one: using ")" in Wingdings will give a little telephone symbol, | which some people like to use as just a little light relief before their | telephone number. You MS Office people are so parochial. Wingdings came out in several versions, made by MS. For years, if I remember correctly, MS Word got later versions than Windows did. So Word users merrily sent their astrological symbols to each other, having no idea it was a limited font. And they sent them to Mac users, with no idea Mac users couldn't see them. I don't see a telephone or a ")" above. It wouldn't matter, anyway. I'm reading in plain text and only see what Verdana can print. That's an example of the problem with wingdings. They're fine if you're going to print it out. But you can't assume anything being universal online or in software. Apparently you assumed here that I'm reading newsgroups as HTML. But why would I do that? For me the emojis are similar. People can't be bothered to write 3 words but they expect me to look up a tiny image that seems to show a crying face with a donut? Or maybe that's a spare tire? Is that even a face? Maybe it's a dripping orange with a spare tire? And when I finally figure it out it will probably mean "Oy". Emojis are for semi-literate teenagers sending texts. I don't see most of them in my browser. I just get little boxes with the hex code for the emoji. (Imagine here that you see a face with tongue sticking out. |
#135
|
|||
|
|||
Image formats
"Ken Blake" wrote
| I don't see any point to .doc, either, in most cases. | Word processors are for writing business letters that | will be printed. I actually keep a script on my desktop | to convert doc to txt. | | Word processors are for writing *many* different kinds of documents, not | just business letters. | Letters that need formatting and maybe graphics, and will be printed. I never have occasion otherwise to fire up a 400 MB monstrosity of bloat and complexity. In my experience, people who use MS Office get accustomed to it and become very profficient with Word. As a result they tend to overuse it and not realize that everyone isn't sitting in front of Word. It starts itself at boot, so you don't see what a resource hog it is. It's forced on college students, so they end up thinking Word = Windows. It hides the location of files. It encourages you to use it for email, even though it creates monstrous HTML emails with nonsense tags starting with "MSO", which are invisible except to people reading their email in MS Office. It's a contained, parochial world of MS Office functionality and convenience, designed to be seamlessly usable for people who work in offices doing word processing, but also designed in such a way that someone can be a serviceable office worker without knowing how to use their computer. I get people sending me email from Word. People send me notes as doc or docx. It's like dealing with people from AOL or people using Macs. They don't actually know how to use a computer because all they've ever used is MS Word. So they don't realize that Word is not the same thing as Windows, and that many people can't even open their files. And those other people probably have no idea why they can't open the files. So it does no good that Libre Office or free MS Office readers are available. (Lately I've noticed that Google Docs is supplanting MS Word. People send links and expect me to sign up with Google so that I can read their file. Huh?! They don't understand how crazy that is. Signing up and signing in with Google was effortless, so what's my problem?) It's fine if you use Word a lot and like it. It's great if what you're doing needs to be printed out. For just about any other purpose it's like the old saying: If all you have is a hammer then everything looks like a nail. I use Libre Office when necessary, for things like work receipts. But I would never send a receipt to a customer as doc or docx or even RTF. There's no reason to expect they can read that. Those are limited MS formats. I always convert to PDF before sending. |
Thread Tools | |
Display Modes | |
|
|