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