Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

There is one auto-adjust item in the right-click menu of image in cell.

And other related items are actual size and magnification.

Can we set some values for the auto-adjust? (the effect like ImageResize[image,100] by hand)

The image was interted/paste in the cell.

enter image description here

share|improve this question
    
I guess you might be interested in CellEvaluationFunction. –  Silvia Jun 13 '13 at 9:15
    
@Silvia I'm not sure if that suit for Image, I'll try that. If somewhere we can edit the value of auto-adjust, that would be the simplest way. –  HyperGroups Jun 13 '13 at 9:17
    
@Silvia fine:) CellPrint[ExpressionCell[Rasterize@x,"Input",CellEvaluationFunction->(ImageCrop‌​@ImagePad[ImageResize[ToExpression[#],100],20]&)]] –  HyperGroups Jun 13 '13 at 9:33
    
hmm.. I didn't see difference between you example and that without the CellEvaluationFunction options. –  Silvia Jun 13 '13 at 9:49
    
@Silvia Evaluate the output cell will generate the effect, or make it one function,or button,This is one old post might related. mathematica.stackexchange.com/questions/25700/… Yeah, seems I still need one function to call the cell. –  HyperGroups Jun 13 '13 at 10:08
show 3 more comments

1 Answer 1

Based on:

Best is scaling determined by width. For example, fixed width is 1000, then image whose width is less that 1000 will keep the actual size, and image whose width is 1200 will be adjusted to 1000, the ratio width/height is the same to that of the original image.

I believe you may use simply:

$PrePrint = # /. i_Image :> Image[i, ImageSize -> 777] &;

This way images in output are automatically scaled to a fixed width (here 777), and only output is affected. That is, if you define:

img = Import["ExampleData/lena.tif"]

The data assigned to img is unchanged, but the output is displayed at the width specified. (If you copy and paste the output the the fixed size is included in that object.)

share|improve this answer
    
This works, but it looks only affect on images in output cells, and I'd like it affect image in Input Style cells or Text Style cells. –  HyperGroups Jun 21 '13 at 1:56
    
@HyperGroups I don't know about that. Would it be an acceptable solution to programmatically process the Notebook to set image sizes throughout? I know that's not ideal, but if no one has a better idea... –  Mr.Wizard Jun 22 '13 at 23:49
    
ok, of course,welcome to add some acceptable solutions. –  HyperGroups Jun 23 '13 at 1:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.