<bdo id='8911f'></bdo><ul id='8911f'></ul>

        <small id='8911f'></small><noframes id='8911f'>

        <legend id='8911f'><style id='8911f'><dir id='8911f'><q id='8911f'></q></dir></style></legend>
      1. <tfoot id='8911f'></tfoot>
        <i id='8911f'><tr id='8911f'><dt id='8911f'><q id='8911f'><span id='8911f'><b id='8911f'><form id='8911f'><ins id='8911f'></ins><ul id='8911f'></ul><sub id='8911f'></sub></form><legend id='8911f'></legend><bdo id='8911f'><pre id='8911f'><center id='8911f'></center></pre></bdo></b><th id='8911f'></th></span></q></dt></tr></i><div id='8911f'><tfoot id='8911f'></tfoot><dl id='8911f'><fieldset id='8911f'></fieldset></dl></div>
      2. 画布绘制图像缩放

        时间:2023-06-19

        1. <i id='nsUQW'><tr id='nsUQW'><dt id='nsUQW'><q id='nsUQW'><span id='nsUQW'><b id='nsUQW'><form id='nsUQW'><ins id='nsUQW'></ins><ul id='nsUQW'></ul><sub id='nsUQW'></sub></form><legend id='nsUQW'></legend><bdo id='nsUQW'><pre id='nsUQW'><center id='nsUQW'></center></pre></bdo></b><th id='nsUQW'></th></span></q></dt></tr></i><div id='nsUQW'><tfoot id='nsUQW'></tfoot><dl id='nsUQW'><fieldset id='nsUQW'></fieldset></dl></div>

              <bdo id='nsUQW'></bdo><ul id='nsUQW'></ul>
            • <legend id='nsUQW'><style id='nsUQW'><dir id='nsUQW'><q id='nsUQW'></q></dir></style></legend>
                <tfoot id='nsUQW'></tfoot>

                    <tbody id='nsUQW'></tbody>

                1. <small id='nsUQW'></small><noframes id='nsUQW'>

                2. 本文介绍了画布绘制图像缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试按比例缩放图像到画布.我可以用固定的宽度和高度来缩放它:

                  I'm trying to scale an image proportionately to the canvas. I'm able to scale it with fixed width and height as so:

                  context.drawImage(imageObj, 0, 0, 100, 100)
                  

                  但我只想调整宽度并按比例调整高度.类似于以下内容:

                  But I only want to resize the width and have the height resize proportionately. Something like the following:

                  context.drawImage(imageObj, 0, 0, 100, auto)
                  

                  我到处寻找我能想到的地方,但还没有看到这是否可能.

                  I've looked everywhere I can think of and haven't seen if this is possible.

                  推荐答案

                  context.drawImage(imageObj, 0, 0, 100, 100 * imageObj.height / imageObj.width)
                  

                  这篇关于画布绘制图像缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:HTML5 画布转 PDF 下一篇:上传前调整图像大小 - 将画布转换为文件对象

                  相关文章

                  • <bdo id='nm53F'></bdo><ul id='nm53F'></ul>

                    <small id='nm53F'></small><noframes id='nm53F'>

                    <i id='nm53F'><tr id='nm53F'><dt id='nm53F'><q id='nm53F'><span id='nm53F'><b id='nm53F'><form id='nm53F'><ins id='nm53F'></ins><ul id='nm53F'></ul><sub id='nm53F'></sub></form><legend id='nm53F'></legend><bdo id='nm53F'><pre id='nm53F'><center id='nm53F'></center></pre></bdo></b><th id='nm53F'></th></span></q></dt></tr></i><div id='nm53F'><tfoot id='nm53F'></tfoot><dl id='nm53F'><fieldset id='nm53F'></fieldset></dl></div>
                    1. <legend id='nm53F'><style id='nm53F'><dir id='nm53F'><q id='nm53F'></q></dir></style></legend>
                      <tfoot id='nm53F'></tfoot>