js 圖片格式轉換爲jpg_如何將圖像轉換爲JPG格式

js 圖片格式轉換爲jpg

js 圖片格式轉換爲jpg

Many websites have strict rules that limit the size and type of image format you’re allowed to upload. With JPG being the go-to file format of the internet, we’re going to take a look at how you can convert your images into JPG format.

許多網站都有嚴格的規則,這些規則限制了您允許上傳的圖像格式的大小和類型。 JPG是Internet的常用文件格式,我們將研究如何將圖像轉換爲JPG格式。

什麼是JPG文件? (What Is a JPG File?)

JPG (or JPEG), is a popular file format used for images and graphics—especially on the internet. It was created by the Joint Photographic Experts Group (JPEG) and uses a compression algorithm that reduces sections of an image into blocks of pixels. It’s able to compress up to a ratio of 10:1 without any noticeable degradation, depending on your settings. This alone is one of the main reasons why JPG has become the de facto standard of images on the internet.

JPG(或JPEG)是一種流行的文件格式,用於圖像和圖形,尤其是在Internet上。 它由聯合圖像專家組(JPEG)創建,並使用壓縮算法將圖像的各個部分縮小爲像素塊。 根據您的設置,它可以壓縮至10:1的比例而不會出現任何明顯的降級。 僅此一點就是JPG成爲互聯網上事實上的圖像標準的主要原因之一。

RELATED: What's the Difference Between JPG, PNG, and GIF?

相關: JPG,PNG和GIF有什麼區別?

However, all that compression doesn’t come without a loss. JPGs are considered a 「lossy」 file format, meaning that during the compression procedure, redundant blocks are permanently deleted. The more you compress a file, the more data you lose and subsequently the worse your final image is going to look after multiple iterations through the algorithm.

但是,所有這些壓縮並非沒有損失。 JPG被認爲是「有損」文件格式 ,這意味着在壓縮過程中,冗餘塊將被永久刪除。 壓縮文件的次數越多,丟失的數據就越多,隨後經過該算法的多次迭代後,最終圖像將變得越差。

Here’s an example of an image that has been way overcompressed.

這是過度壓縮圖像的示例。

Still, when used properly, JPG delivers decent-looking images with small file sizes. Whether you’re sending one in an email, posting a meme on Reddit, or uploading your vacation pictures to Facebook, because of its ability to compress images at such a high rate, your final file is a fraction of its original size.

不過,如果使用得當,JPG仍可以提供小文件尺寸的美觀圖像。 無論您是通過電子郵件發送郵件,在Reddit上發佈meme還是將度假圖片上傳到Facebook,由於其能夠以如此高的速率壓縮圖像,最終文件僅是原始大小的一小部分。

RELATED: How Does File Compression Work?

相關: 文件壓縮如何工作?

如何將圖像轉換爲JPG格式 (How to Convert an Image Into JPG Format)

You can convert an image into JPG format using an image editing app on your computer or one of the many file conversion sites available on the web.

您可以使用計算機上的圖像編輯應用程序或網絡上可用的許多文件轉換站點之一將圖像轉換爲JPG格式。

在Windows中將圖像轉換爲JPG (Converting an Image to JPG in Windows)

Most image-editing programs allow you to convert an image to JPG. Unfortunately, the Photos app built into Windows 10 isn’t one of them. You can do it with Paint (or Paint 3D), or you can download a third-party image app.

大多數圖像編輯程序都允許您將圖像轉換爲JPG。 不幸的是,Windows 10中內置的「照片」應用不是其中之一。 您可以使用Paint(或Paint 3D)完成此操作,也可以下載第三方圖像應用程序。

Our favorite app for quick image work is IrfanView. It’s free, can open almost any format out there, has some good basic editing tools, and it’s very fast. We’ll be using it in our example here, but the process is pretty much the same in most apps.

我們最喜歡的用於快速圖像處理的應用程序是IrfanView 。 它是免費的,可以在那裏打開幾乎任何格式,具有一些很好的基本編輯工具,而且速度非常快。 我們將在此處的示例中使用它,但是大多數應用程序的過程幾乎相同。

RELATED: Why You Should Replace Windows' Default Image Viewer With IrfanView

相關文章 爲什麼要用IrfanView替換Windows的默認圖像查看器

Start by opening the image you want to convert in whatever app you’re using. All we’re going to be doing is saving the app as another file type, so you should be able to follow along no matter what app you have.

首先在要使用的任何應用程序中打開要轉換的圖像。 我們要做的就是將應用程序另存爲另一種文件類型,因此無論您擁有什麼應用程序,您都應該能夠繼續進行下去。

Click the 「File」 menu and then click the 「Save As」 command.

單擊「文件」菜單,然後單擊「另存爲」命令。

In the Save As window, choose the JPG format on the 「Save As Type」 drop-down menu and then click the 「Save」 button.

在「另存爲」窗口中,在「另存爲類型」下拉菜單上選擇JPG格式,然後單擊「另存爲」按鈕。

The default quality is fine if you want to convert directly into JPG, but if you want a little more control over the compression of your file, the Save Options window has a couple of extras to check out. Selecting the image quality is the same as the compression rate—the higher the quality, the less your image is compressed and the bigger the file. IrfanView also includes a nice feature that lets you set a file size limit.

如果您想直接轉換爲JPG,則默認質量很好,但是如果您想要對文件的壓縮進行更多控制,則「 保存選項」窗口中還有幾個要檢查的附加功能。 選擇圖像質量與壓縮率相同-質量越高,圖像被壓縮的次數越少,文件越大。 IrfanView還包括一項不錯的功能,可讓您設置文件大小限制。

在macOS中將圖像轉換爲JPG (Converting an Image to JPG in macOS)

Mac comes pre-installed with Preview, which you can use for more than just viewing image files. It’s a great image editing program capable of cropping, resizing, and converting files.

Mac預裝了Preview,您可以將其用於查看圖像文件以外的其他功能。 這是一個很棒的圖像編輯程序,能夠裁剪,調整大小和轉換文件。

To open an image in Preview, select it in Finder, hit the Spacebar, and then click the 「Open with Preview」 button. You can also right-click the file, point to the 「Open With」 menu, and then click the 「Preview」 option.

要在「預覽」中打開圖像,請在Finder中選擇它,單擊空格鍵,然後單擊「使用預覽打開」按鈕。 您也可以右鍵單擊文件,指向「打開方式」菜單,然後單擊「預覽」選項。

In the Preview window, click the 「File」 menu and then click the 「Export」 command.

在「預覽」窗口中,單擊「文件」菜單,然後單擊「導出」命令。

In the window that pops up, select JPEG as the format and use the 「Quality」 slider to change the compression used to save the image. Higher compression means a smaller file size, but you also lose some image quality. When you’re ready, click the 「Save」 button.

在彈出的窗口中,選擇JPEG作爲格式,然後使用「質量」滑塊更改用於保存圖像的壓縮率。 較高的壓縮率意味着較小的文件大小,但是也會損失一些圖像質量。 準備好後,點擊「保存」按鈕。

Preview saves the new JPG file in the same location as your original image.

預覽將新的JPG文件保存在與原始圖像相同的位置。

在線轉換圖像 (Converting an Image Online)

If you prefer using an online file conversion site instead of a desktop app, then look no further than Convertimage.net. The site is dedicated to the conversion of images —not just JPG— while keeping your privacy in mind. ConvertImage does not publish or keep any of your files longer than 15 minutes, deleting them from their servers after processing.

如果您更喜歡使用在線文件轉換站點而不是臺式機應用程序, 則只需要使用Convertimage.net即可 。 該網站致力於圖像的轉換(不僅僅是JPG),同時牢記您的隱私。 ConvertImage不會發布或保留您的任何文件超過15分鐘,而是在處理後將其從其服務器中刪除。

First, select the output format to which you want your image saved.

首先,選擇要將圖像保存到的輸出格式。

Next, click the 「Select Your Image」 button.

接下來,單擊「選擇您的圖像」按鈕。

Navigate to the image you want to convert and click 「Open.」 Note that the site supports images with a maximum size of 24.41 MB.

導航到要轉換的圖像,然後單擊「打開」。 請注意,該站點支持最大大小爲24.41 MB的圖像。

Now all you have to do is agree to their terms of use and then click the 「Convert This Image」 button.

現在,您要做的就是同意他們的使用條款,然後單擊「轉換此圖像」按鈕。

On the next page, after your image has been converted, click 「Download The Image」 and your JPG is saved to your browser’s downloads folder.

在下一頁上,將圖像轉換後,單擊「下載圖像」,並將JPG保存到瀏覽器的下載文件夾中。



Now that all your images have safely been converted into the internet-friendly format, you’re able to take your JPGs and upload them wherever without having to worry what format they’re in.

現在,您所有的圖像都已安全地轉換爲適合互聯網使用的格式,您就可以拍攝JPG並將其上傳到任何地方,而不必擔心它們的格式是什麼。

Have a favorite method for converting all your images into JPG we didn’t cover? Let us know in the comments section below.

有沒有喜歡的方法將您所有的圖像轉換成我們沒有介紹的JPG? 在下面的評論部分讓我們知道。

翻譯自: https://www.howtogeek.com/362730/how-to-convert-an-image-to-jpg-format/

js 圖片格式轉換爲jpg