1

I need to resize a local image from the assets folder in my markdown file.

I currently have this image that does display in my .md file.

enter image description here

I need to resize the image to make it a bit smaller.

Is it possible with the current package?

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
RPN
  • 31
  • 1
  • 5

3 Answers3

0

You can use inline HTML <img/> with providing size.

<img src = "assets/images/image01.png" width="x" height="x" />

Or

[<img src ="assets/images/image01.png" width="100" height="x"/> ](assets/images/image01.png)

More and ref: Changing image size in Markdown

Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
0
<img src="drawing.jpg" alt="drawing" width="200"/>

This the github discussion on this, https://gist.github.com/uupaa/f77d2bcf4dc7a294d109

Dharman
  • 30,962
  • 25
  • 85
  • 135
Manishyadav
  • 1,361
  • 1
  • 8
  • 26
0

When considering specifically the Flutter Markdown plugin, a good way to resize images is to make use of the imageBuilder parameter.

For your example, here is the code that would resize the image when returning the Markdown Widget:

imageBuilder: (uri, title, alt) {
  return Image.asset(uri.path,width: 50,height: 50,);
},

For other cases such as network images for example, you can find inspiration from the default function called, kDefaultImageBuilder when no imageBuilder is specified: https://github.com/flutter/packages/blob/ec4a54604ff5043891bae98498116a714061baa5/packages/flutter_markdown/lib/src/_functions_io.dart#L18-L42

luvzfootball
  • 710
  • 1
  • 9
  • 21