https://bugs.documentfoundation.org/show_bug.cgi?id=98931
Bug ID: 98931
Summary: Insert images into cells in Calc
Product: LibreOffice
Version: 5.1.1.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
I would like to be able to view images in Calc which are located inside cells.
As simple as that.
This is an actual need, I am not making this up, so don't close as "not needed"
or "works for me". If you do, it'll show you don't necessarily care about what
your users need and instead would like to push Calc in the direction of your
own vision of what Calc should be. Currently Calc missing this functionality
has me and others like me relegated to ugly hacks (see below), Google
Spreadsheets, or a myriad of web-based solutions cobbled together from
Wordpress or Drupal. This shouldn't be necessary for legitimate uses of a
spreadsheet. This functionality can do a lot for Calc, from enabling uses of
Calc that are perfectly natural for the users (and are already being done by
inferior, kludgy web software), to drawing the attention of skilled minds and
developers in the Machine Learning and Computer Vision communities.
I will describe the functionality I'd like below, but first let's dispell the
myth that this feature is not necessary in Calc. Here are reasons people have
cited for not implementing this feature over the years:
Q: Calc cells are for data. Images are not data. / Calc is not Writer. It does
not need pretty images.
A: Calc needs images. I have a spreadsheet of physical things and when I have
to pick it up from storage I need to know what it looks like, because that's
what I search for. I am not going to describe them like "small round object
with green sides and a blue dot" just because I can't have images. Or let's say
I have a list of people who are working with me, I would like to see the
picture of the person so they're not just faceless numbers on a list and I can
immediately associate the data to who they are. Or maybe display stock tickers
on a spreadsheet of stocks. Myself, I would like to see how much items are
currently being sold for on the internet, so I would make graphs of that, to
see trends and buy/sell smart. Images are data. Calc is NOT a programming
language. If you think "data" only means text, then you are terribly wrong.
Calc is made for usage by humans, and images carry a lot of information for
humans, information which can NOT be replaced by text information. Calc is for
data, and calc is for humans, therefore it should display data for humans, and
that means images too.
Q: Calc cannot make meaningful use of image data.
A: So implement features like this as well rather than go "stuff is not
implemented so let's not implement stuff". Examples: search/sort by color, by
EXIF data, by aspect ratio. Ability to access the bitmap from the scripting
language to perform machine learning algorithms. Ability to modify bitmap data
to display visualizations. For example, LO already has the ability to run
JavaScript. With a place to output images we could have d3.js visualizations
associated to our row or column data in a meaningful way. We could have
location data displayed as an *actual map* in the cell. We could have addresses
displayed beside street view photos of them to help finding them.
Q: Add an image and anchor it to a cell.
A: Doesn't work for me. First of all it's very fiddly. Most importantly, when
you resize or sort data the images don't follow the data, since an image
anchored to B3 will always be anchored to B3, even if the data moved down to
B12. Second of all, I can't easily resize the image to look at it in detail.
Also, the functionality often doesn't work, images get distorted, get resized
improperly, or don't show up at all. When you save and re-open the document,
they get shifted around and you don't know what cell they were assigned to
before.
Q: Use a comment. Put it in the background, and edit its formatting options.
A: Doesn't work for me. Even though sorting makes images move around together
with the data, it's still pretty crappy. First of all, I can't easily resize
the cell to get a larger image to see it better. Second of all, the amount of
manual work you have to do is huge. I need to add a comment, add some text
inside it, exit the comment, right click the comment, select the background
options, create a new bitmap, import it, then resize the comment, move it into
the cell, and resize the cell, then move the comment into the background. When
resizing the comment I need to get it just right because this ugly hack makes
the image tile and I need the image once only. Additionally, since *none* of
the images I have on disk will be the right size, I will have to resize the
image in an external editor, and save it out. This is all terrible.
-----------
What I request (functionality that HAS to be implemented for my issue to be
resolved):
1. A simple way to display an image in a cell. This should be ~5 clicks max.
The cell probably shouldn't hold text at the same time as an image. This is not
a formatting option, this is a data option, so don't make it a formatting
option.
2. The image should resize to the cell, take up the whole cell, resized with
aspect ratio, touching edges from the inside. Resizing the cell should make the
image larger.
2a. There should be a formatting option that says the image should touch the
cell from the outside, not the inside, i.e. it is being cropped.
2b. There should be a formatting option that says the image should go into
"touch from outside" mode below a certain width or height, specified in text
lines.
2c. There should be a formatting option that specifies the vertical/horizontal
alignment when the image is in "touch from outside" mode. top/center/bottom,
left/center/right.
3. Image follows data around through sorting, copy/paste, deletions of rows
above, etc.
4. A simple one-click way to display the image full-size, maybe a small
magnifying glass icon that shows up if you hover the image.
5. The ability to import the image using a macro. You edit the cell and go
=image("file.jpg") or =image("http://file.jpg") and the cell now displays the
image. This needs to work during CSV import too. File names that appear
relative are loaded from the directory the spreadsheet was saved to, or if
none, current working directory. There should be an ability to load images from
absolute paths. There should be an ability to load from URL. Once loaded the
images are stored inside the spreadsheet file. The user needs to be made aware
that loading images could compromise security, e.g. someone could write a
malicious spreadsheet that loads data that should be kept secret (think
passwords etc).
6. The ability to zoom the image using one click. When you hover the cell, a
small, transparent, magnifying glass icon should show up and when you click it
the image displays over the spreadsheet (think "lightbox") until you click on
it or press escape. This is "image viewing mode".
7. When in image viewing mode, moving the cursor around with arrows changes the
image.
8. Moving onto a cell without an image does not exit the mode, it just displays
a blank image.
9. There should be a simple keyboard combination to enter image viewing mode,
or the ability to define one globally in my installation of LibreOffice Calc.
10. There should be arrows on the image viewer clicking which will move the
cursor. Arrows for up, down, left, right. A cross for exiting.
11. Images show up in printouts, in the size of the cell they are in, using the
specified formatting options.
What I think would be useful. It would make the functionality much more
valuable:
1. New data type that defines a single color in RGB or HSL mode. Those should
be two separate data types, rather than convert everything to one color space,
due to numerical precision.
2. An API to read image data from macros. This should be in callback style, and
the call should carry information on cell size. The callback should have access
to an object or variable that persists between calls (e.g. this could carry
state that is very slow to load).
3. A GUI function to sort data by color proximity to a picked color. You select
this from the menu, get a HSL color picker, and once you've picked the color
and pressed OK, all images get evaluated by how close their colors are. For
example, for each pixel you could measure the distance from the colour picked,
and all pixels get averaged. The formula for this might be e.g. 1/(#
pixels)*Sum_i|H(P_i) - H(picked)|. That is the average of: for each pixel, the
distance from the HSL Hue of that pixel to the Hue of the picked colour. But
there might be other, better comparison modes, and this should be experimented
with. A better formula might be 1/(# pixels)*Sum_i L(P_i)*|S(P_i) -
S(picked)|*|H(P_i) - H(picked)|.
4. A GUI function to sort data by color. Like above, but every image gets
tested against every value of "Hue" using the formula: 1/(# pixels)*Sum_i
S(P_i)*L(P_i)*|H(P_i) - H(searched)|. That means, saturated colours are more
important than unsaturated ones. Then for each image, the H that got the
highest score gets assigned to the image, and then images get sorted by H.
5. An API and a GUI function to search by formula. For example, someone could
implement a computer vision library that'll let me search for all rows
containing images of paper clips.
6. An API for writing to a cell's image. This should be in callback style, and
the call should carry information on cell size. The callback should have access
to an object or variable that persists between calls (e.g. this could carry
state that is very slow to load).
7. An API to turn a cell into "image mode" and back into "text mode". I'm not
sure there should be "image mode" and "text mode" but I guess so. Maybe you'll
have a better idea.
This has been requested a multitude of times before, over the years, by various
people, without acceptable resolution. Please, this time, implement this,
rather than wave it off without empathy for the necessity this carries for
other people, who have other needs than you. If you don't want to implement
this, or think that it does not fit your personal vision of what Calc should
be, do not close this ticket, leave it open for someone else who would like to
add this functionality to Calc.
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs